Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT: My first answer was wrong for VBScript, now my next try...</strong> </p> <p>Nice idea to use CTRL-Z, but I don't like control characters in a batch file, as it is problematic to copy&amp;paste them.<br> It's depends of your browser, of your editor, of your ...</p> <p>You could get a hybrid VBScript/Batch also with normal characters, and "normal" code. </p> <pre><code>:'VBS/Batch Hybrid : : :'Makes the next line only visible for VBScript ^ a=1_ &lt;1' echo off &lt;nul set n=nothing' &amp; goto :'batchCode &amp; REM Jump to the batch code 'VBScript-Part wscript.echo "VB-Start" wscript.echo "vb-End" wscript.quit(0) 'Batch part :'batchCode set n=n'&amp; echo Batch-Start set n=n'&amp; echo two set n=n'&amp; echo Batch-End set n=n'&amp; cscript /nologo /E:vbscript vbTest.bat </code></pre> <p>The trick is to prepend each batch line with <code>set n=n'&amp;</code> it is legal for both, but vbs will ignore the rest of the line, only batch will execute the rest of the line.</p> <p>The other variant is <code>:'remark ^</code>, this is a remark for both, but for batch this remarks also the next line by the multiline character.<br> The VbScript sees then <code>a=1&lt;1</code> the rest of the line is a remark <code>'</code><br> The batch sees only <code>&lt;1' echo off &lt;nul</code>, the first redirect from <code>1'</code> will be override by the second <code>&lt;nul</code>, so it results to only <code>echo off &lt; nul</code>. </p> <p>The only remaining problem is that you can see the first <code>echo off</code>, as it doesn't work in batch to use the <code>@</code> after a redirection.</p> <p>For JScript exists a simpler solution <a href="https://stackoverflow.com/a/5656250/463115">hybrid scripting</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload