DOSCMD.EXE is an ESL local application that will allow you to perform virtually any basic DOS command. This gives you the ability to perform commands such as "DIR C:\*.*" and have ESL take responses to the filenames that are returned. The only requirements for using this local application is that DOSCMD.EXE is in your path.
Once you start this local application you can send any typical DOS command to it, as long as you obey three simple rules:
1.The command must not depend on any user input, other than the parameter list that you specify.
2.The command must not redirect the output. (i.e. "dir > files.dat")
3.The command must use stdin and stdout, and not perform any direct keyboard reading or video writing.
Here are some examples of commands you can execute with DOSCMD.EXE:
DIR C:\*.BAT
DEL C:\ESLWIN\JUNK.DAT
COPY C:\AUTOEXEC.BAT D:\BACKUP.BAT
These are examples of commands you cannot execute since they all require further user input:
DEL *.*
FORMAT A:
DIR /P
TYPE AUTOEXEC.BAT | MORE
Once you send a command to DOSCMD.EXE it will immediately attempt to execute it. If the program runs into any problems it will return a line to ESL that begins with "ERROR:". If no errors are encountered then DOSCMD.EXE will return any lines that would normally be returned by the command that was executed. After the command has finished executing DOSCMD.EXE will send the line "SHELL: Done" to the ESL program.
When you have finished using this local application you should send it the command "EXIT". DOSCMD.EXE will then send the message "SHELL: Exit" to your ESL application, and shut down.
For an example of how to use DOSCMD.EXE see the ESL sample program DOSCMD.EAL.
Returning DOS errors to your ESL Application:
By default DOSCMD.EXE will return DOS errors (stderr) back to your ESL application along with the normal output (stdout). If you do not want to receive the DOS error information then you should invoke DOSCMD.EXE with the "-r" or "-R" parameter.
As an example, if you try to delete a nonexistant file from a DOS command prompt, the message "File not found" is displayed. If you try to delete a nonexistant file by using DOSCMD.EXE then you will receive the same error message, "File not found".
If you do not want to receive this error message then you should invoke DOSCMD.EXE using the "-r" or "-R" flag.
For more detailed information on how DOSCMD.EXE works please see the source code and comments in DOSCMD.C.