Batch Files

Embedding Javascript in a Batch File

Jim Lawless
The program below is both a batch file and a JavaScript WSH console file. The dual nature of the file is achieved via JavaScript block comments and the strategy by which the command interpreter searches for target labels in a batch file. Save the file below as hybrid.bat … rem ( /* @echo off cscript /nologo /e:javascript hybrid.bat goto end */ ) // by Jim Lawless // This program sample is in the public domain function rem() { WScript.