The WIL Tutorial
|
WIL can run DOS programs, just like it runs Windows programs:
If you want to use an internal DOS command, such as DIR or TYPE, you can do so by running the DOS command interpreter, CMD.EXE, with the /c program parameter, as follows:
Everything that you would normally type on the DOS command line goes after the /c in the second parameter. Here's another example:
These examples assume that cmd.exe is in a directory on your DOS path. If it isn't, you could specify a full path name for it:
Or, better still, you could use the WIL Environment function.
Environment (env-variable)Gets a DOS environment variable. Since DOS always stores the full path and filename of the command processor in the DOS environment variable COMSPEC, it is an easy matter to retrieve this information:
and use it in our WIL program:
To get a DOS window, just run CMD.EXE with no parameters:
64-bit Windows ArchitectureWhen running WinBatch on a system with 64-bit architecture, you must deal with is something called File Redirection. For example, when launching the Windows Command Shell (CMD.EXE), Windows decides automatically which bit depth to load, depending on the calling application. e.g. 32 bit for 32 bit, 64 bit for 64 bit.
What if you don’t want that? Then you must explicitly run specific bitness of CMD.EXE by specifying full path name, as follows: To explicitly run the 32-bit version of a command:
To explicitly run the 64-bit version of a command:
|