People have been embedding and executing VBScript within batch files for a long time. But all the published solutions that I have seen (at the time this question was ori
EDIT: My first answer was wrong for VBScript, now my next try...
Nice idea to use CTRL-Z, but I don't like control characters in a batch file, as it is problematic to copy&paste them.
It's depends of your browser, of your editor, of your ...
You could get a hybrid VBScript/Batch also with normal characters, and "normal" code.
:'VBS/Batch Hybrid
:
:
:'Makes the next line only visible for VBScript ^
a=1_
<1' echo off
The trick is to prepend each batch line with set n=n'&
it is legal for both, but vbs will ignore the rest of the line, only batch will execute the rest of the line.
The other variant is :'remark ^
, this is a remark for both, but for batch this remarks also the next line by the multiline character.
The VbScript sees then a=1<1
the rest of the line is a remark '
The batch sees only <1' echo off
1'
will be override by the second echo off < nul
.
The only remaining problem is that you can see the first echo off
, as it doesn't work in batch to use the @
after a redirection.
For JScript exists a simpler solution hybrid scripting