Skip to content

Instantly share code, notes, and snippets.

@gffcoutinho
Last active September 30, 2023 20:07
Show Gist options
  • Save gffcoutinho/e5253ee66c8239ece863 to your computer and use it in GitHub Desktop.
Save gffcoutinho/e5253ee66c8239ece863 to your computer and use it in GitHub Desktop.
@if (true == false) @end /*
@echo off
cscript //nologo //e:javascript "%~dpnx0" %*
pause
goto :EOF */
WScript.Echo('Hello from JScript');
<!-- :
@echo off
mshta.exe "%~f0" %*
exit /b
rem
-->
<html>
<head>
<title>Command Line Agruments</title>
<HTA:APPLICATION
ID="objTestHTA"
APPLICATIONNAME="Command Line Agruments"
SINGLEINSTANCE="yes"
>
</head>
<SCRIPT Language="VBScript">
alert(objTestHTA.commandLine)
Sub Window_onLoad
arrCommands = Split(objTestHTA.commandLine, chr(34))
For i = 3 to (Ubound(arrCommands) - 1) Step 2
Msgbox arrCommands(i)
Next
End Sub
</SCRIPT>
<body>
</body>
</html>
<!-- :
@echo off
start "" mshta.exe "%~f0"
exit /b
-->
<html>
<head><title>HTA window</title></head>
<body><h1>Hello, world!</h1></body>
</html>
@if(0)==(0) ECHO OFF
start wscript.exe //nologo //E:JScript "%~f0" %*
GOTO :EOF
@end
var ws = WScript.createobject('wscript.shell');
var getXmlHttp = (function() {
if (undefined != XMLHttpRequest) {
return function() {
return new XMLHttpRequest();
};
} else {
return function() {
return new ActiveXObject("Microsoft.XMLHTTP");
};
}
})();
ws.Exec("control desk.cpl")
WScript.Sleep( 1000 );
ws.SendKeys("%l")
WScript.Sleep( 500 );
ws.SendKeys("%a")
WScript.Sleep( 500 );
ws.SendKeys("{ESC}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment