Knowledge and references to share

@if (false)==(false) @cscript //nologo //e:jscript "%~dpnx0" %* & goto :eof @end
/* The first line of this file needs to remain unchanged.
 * It holds a preamble which will run the current file as
 * a JScript WSH script despite having a .bat extension.

 * Documenation:
 * http://msdn.microsoft.com/en-us/library/58dz2w55%28VS.85%29.aspx
 * http://blogs.msdn.com/b/joshpoley/archive/2008/01/15/running-jscript-in-a-cmd-file.aspx

 * The @if and @end are Case Sensitive!!
 * @if (condition) statements @end is JScript conditional compilation
 * @if (text1)==(text2) COMMAND is CMD Batch contitinal exection

 * The trick is that JScript will fail the test (false) 
 * and ignore everything between @if and @end.  The test does not matter
 * for CMD Batch because the command REM /* is valid.
 */

// JScript goes here.

Leave a comment