This part of the document was written by Hans <lermen@fgan.de>.
This chapter deals with starting DOS commands directly from Linux. You can use this information to set up icons or menu items in X. Using the keystroke, input and output redirection facilities you can use DOS commands in shell scripts, cron jobs, web services, and so on.
The default autoexec.bat file has a statement unix -e at the end. This command executes the DOS program or command that was specified on the dosemu command line.
For example:
dosemu "/home/clarence/games/commander keen/keen1.exe" |
Lredir "/" if the specified program is not available from an already-redirected drive,
"cd" to the correct directory,
execute the program automagically,
and quit DOSEMU when finished, all without any typing in DOS.
You can also specify a DOS command, such as "dir". A combination with the -dumb command-line option is useful if you want to retrieve the output of the DOS command, such as
dosemu -dumb dir > listing |
Make use of the -input command-line option, such as
dosemu -input 'dir > C:\\garbage\rexitemu\r' |
\r Carriage return == <ENTER> \n LF \t tab \b backspace \f formfeed \a bell \v vertical tab \^x <Ctrl>x, where X is one of the usual C,M,L,[ ... (e.g.: \^[ == <Ctrl>[ == ESC ) \Ax <Alt>x, hence \Ad means <Alt>d \Fn; Function key Fn. Note that the trailing ';' is needed. (e.g.: \F10; == F10 ) \Pn; Set the virtual typematic rate, thats the speed for autotyping in. It is given in unix timer ticks to wait between two strokes. A value of 7 for example leads to a rate of 100/7=14 cps. \pn; Before typing the next stroke wait n unix ticks. This is useful, when the DOS-application flushes the keyboard buffer on startup. Your strokes would be discarded, if you don't wait. |
Make a file "FILE" containing all keystrokes you need to boot DOSEMU and to start your dos-application, ... and don't forget to have CR (literal ^M) for 'ENTER'. FILE may look like this (as on my machine):
2^Mdir > C:\garbage^Mexitemu^M |
and execute DOSEMU like this:
dosemu -dumb < FILE |
In bash you can also use
echo -e 'dir \gt; c:\\garbage\rexitemu\r' | dosemu -dumb |
echo -e 'dir\rexitemu\r' | dosemu -dumb > FILE.out |
FILE.out then contains the output from the DOS application, but (unlike the unix -e technique, merged with all startup messages.
You may elaborate this technique by writing a script, which gets the dos-command to execute from the commandline and generate 'FILE' for you.
When you try to use one of the above to start DOSEMU out of a crontab, then you have to asure, that the process has a proper environment set up ( especially the TERM and/or TERMCAP variable ).
Normally cron would setup TERM=dumb, this is fine because DOSEMU recognizes it and internally sets it's own TERMCAP entry and TERM to `dosemu-none'. You may also configure your video to
dosemu ... -dumb |