This following example is created by user Michael Dillon from this answer.


Consider the following script:

@set @junk=1 /*
@echo off
cscript //nologo //E:jscript %0 %*
goto :eof
*/

//JScript aka Javascript here

This script snippet does:

  • Execute the cscript command which calls itself with all the arguments provided.

  • As the part after @set @junk=1 is commented(/* and */ Are valid JScript comment),

  • JScript will ignore them.

  • Note: We need the @set @junk=1 part because the batch file does not recognize /* as a command, but a set statement will be a workaround. JScript will recognize /* as a comment so the other batch file will not be executed by JScript engine.


You can add your JScript after */ and start extending your batch file scripting!