Question: I am using Windows. I have connected my printer to a serial port. I use a few DOS applications which dump data to LPT1 so I want to reroute LPT1 to COM1 and set the baud rate to 9600. When I apply the mode command for any particular DOS prompt and run the print job it works but if I close the DOS prompt and open a new DOS prompt then a print job wont work until I re-enter the mode command. I tried appending the mode command in autoexec.bat but that doesn't solve the problem.
Answer You have the right idea but the autoexec.bat where you have placed the mode command may not be the one that the DOS window is running when you start a new DOS session. Windows allows you to define specific config.sys and autoexec.bat files for each individual DOS program (including the DOS command prompt). To make sure that the commands you want are executed when you open a DOS window try associating the command with the specific window instead of using the general autoexec.bat file.
I assume that you are opening the DOS prompt from the Start/Programs menu. Instead of clicking on MS-DOS Prompt with the left mouse button, click with the right mouse button and then click on Properties. If you use a DOS prompt icon from anywhere else then right click that one instead.
In the Properties box click on the Program tab and then on the Advanced button. This will open the advanced program settings dialog box. Now select MS-DOS Mode and Specify a new MS-DOS configuration. You will now have access to define the specific values for the config.sys and autoexec.bat files that will be used for this specific DOS program (in this instance your DOS prompt).
All you need to do now is to enter the mode command in the AUTOEXEC.BAT for MS-DOS mode. section at the bottom of the window. This will ensure that the command gets run every time that you open a DOS prompt from the particular menu entry or icon that you right clicked.
The commands that you need to enter to redirect LPT1 to COM1 and set the baud rate to 9600 are as follows:
This article written by Stephen Chapman, Felgall Pty Ltd.