Click a heading below to reveal the tips.
Command.com is the real mode shell and the console shell. Windows 98 terminology is MSDos Mode for real mode and MSDos Prompt for console mode.
This section describes Command.com command line switches and some uses for them.
COMMAND [path] [device] [/E:nnnnn] [/P] [/Y] [/Z] [/F] [/D] [/C command|/K command]] [/MSG] [/L:nnnn] [/U:nnn] [/LOW]
SHELL=[path to]COMMAND.COM [path][device][/E:nnnn] [/P] [/Y] [/Z] [/F] [/D] [/MSG] [/L:nnnn] [/U:nnn] [/LOW]
|Path||Set the COMSPEC environmental variable which specifies the path to command.com.|
|Device||Sets the device to recieve input and output. Normally is CON (keyboard for input and screen for output) but could be the serial device (COM1) or a file.|
|E:nnn||Sets the space for environmental variables [256 to 32,768].|
|/P||Makes command.com permanent, runs Autoexec.bat. Implied in the Shell= command.|
|/Y||Steps through batch files line by line.|
|/Z||Reports the error level returned by each command.|
|/F||Sets critical errors to Fail rather than asking "Abort, Retry, or Fail".|
|/D||Prevents Autoexec.bat from running. Use with /P.|
|/C command||Runs the specified command and returns. This and /K are the only way to run an internal Command.com command from a Windows' shortcut or Start - Run dialog box.|
|/K command||Runs the specified command and continues running. This and /C are the only way to run an internal Command.com command from a Windows' shortcut or Start - Run dialog box. When a command is run from Windows /K in needed to see the output from the command.|
|/MSG||Loads Command.com error messeges into memory. Use with /P|
|/L:nnn||Specifies internal buffers length (128 to 1,024). Use with /P.|
|/U:nnn||Specifies the input buffer length [128 to 255]. Use with /P.|
|/LOW||Loads command.com low. Used when loading MS-Dos high.|
|command||Any Command.com internal command or any external command. In the MSDos Prompt these can be Windows commands. Use Start.exe for full Windows command line support.|
|SHELL||A Config.sys command that sets the default command shell for Dos. Using it will force Command.com to stay in memory when windows starts and will mean two copies of Command.com in MS-Dos Prompt. Only recommended if the environment space needs to be increased.|
To issue internal Dos commands from a windows command line use the following syntax;
command /k internal command
use /c instead of /k if you don't want to see the output. To copy some file and exit use;
command /c copy c:\autoexec.bat a:\autoexec.bak
|Internal Command||Description||Internal Command||Description|
|BREAK||Sets how often Ctrl+Break is checked||PATH||Specifies the search path for external commands|
|CALL||Transfers control to another batch file||PAUSE||Halts execution until a key is pressed|
|CHCP||Change Code Page||PROMPT||Specifies how the command prompt appears|
|CHDIR CD||Change Directory||REM||Indicates a comment in a batch file|
|CLS||Clear the screen||RENAME REN||Renames a file|
|COPY||Copies a file, joins files, deletes zero bytes files||RMDIR RD||Removes an empty directory|
|CTTY||Changes input and output device||SET||Displays all or sets an environmental variable|
|DATE||Displays / sets the date||SHIFT||Used with processing command line parameters in batchfiles|
|DEL ERASE||Deletes a file||TIME||Displays / sets the date|
|DIR||Displays a directory listing and with /c or /ch displays compression||TRUENAME||Displays the true name and path of the file or folder|
|ECHO||Turns on or off screen displays / displays a message||TYPE||Displays a file on screen|
|EXIT||Exits a temporary Command.com||UNLOCK||Unlocks a drive|
|FOR||Process a group of files||VER||Displays the version no. of Dos/Windows and with /R the location of the Dos kernel|
|GOTO||Jumps to a label in a batch file||VERIFY||Turns on or off verification of disk writes|
|IF||Conditionally executes a command based on stringcomparison, exit codes, or existence of a file or folder||VOL||Displays or sets the volume label|
|LFNFOR||Process a group of files using long file names (MSDosPrompt only)||::||Works as a comment in a batch file|
|LOADHIGH LH||Loads a program into upper memory||@||@ at the beginning of a line suppresses the echoing of the line|
|LOCK||Locks a drive for low level access||<||The < symbol redirects input to a program|
|MKDIR MD||Creates a directory||>||The > symbol redirects output from a program|
|NOT||Used with IF|||||The | symbol takes output from one program and feeds it to another|
Use CommandName /? to find out the switches for each internal command. Download a help file listing the switches. (15K)
Thats Echo, full stop, then a space.
The @ character prevents the echoing of a line. Most batch files start with this command that turn echoing off, and the @ symbol prevent the echo off command from echoing itself.
If errorlevel n if not errorlevel n+1 <command to do>
As errorlevel tests always test for a number equal or higher, this code snippet only evaluates if the number is exactly the same. So if testing for errorlevel 6
If errorlevel 6 if not errorlevel 7 Echo The error level was 6
If "%1"=="" <command to do>
Parameters need to be enclosed in double quotation to test for a blank string.
Copy the following lines into a text file called iswin.scr.
then type the following in a dos command prompt
debug < iswin.scr
This will create a file called iswin.com that will return an error lever of 6 if Windows 98 (or 3.1 in enhanced mode) is running.
This is from Microsoft's Knowledge Base
The for command repeats a command on a series of files. The syntax is slightly different depending if it's in a batch file or at a command prompt. It is nestable. Use double % in a batch file. The letter can be any letter but not a number.
At the command prompt this will type all text file to the screen.
for %a in (*.txt) do type %a
In a batch file use
for %%a in (*.txt) do type %%a
Because this is difficult to read press the pause key or Ctrl + S to stop it, Ctrl + Q or any key to restart it, and Ctrl + C or Ctrl + Break to exit it
There are many ways of doing this, the easiest is to set up text files with a Y and an enter and an enter only. Call them Y.TXT and CR.TXT. This will answer the time prompt with a enter key.
time < cr.txt
Or use the echo command
Thats echo, full stop, space, pipe character, then time.
From MSDos mode use restart.com. This is in EBD.CAB in C:\windows\command\ebd, if it's not, extract EBD.CAB from BASE4.CAB on the window 98 CD-Rom.
You can also use
echo g ffff:0000 | debug
In Windows see the tips on the General Tips page.
Running batch files from windows is different than running from real mode. Windows doesn't wait for a command to finish before starting the next one. Use the start command with the /W switch to make windows wait.
Start /w Scandskw /all /non /silent
start /w defrag /all /nop
Start also gives a windows command line.
The first will open mydoc in Word and the second will open an explorer window in your current directory.
There's not too much here. Use the choice command and test for errorlevels. Escape can be used with choice in a batch file. Use Edit.com and press Ctrl + P, Escape and a left arrow will be inserted which is the escape key.
choice /c:<a left facing arrow>123
If a shortcut is created to a batch file (or any MS-Dos program) placing a question mark after the program name will prompt the user for parameters.
To make a beep in MSDos mode use echo followed by Ctrl + G, at the dos command prompt
or in a batch file use Ctrl P Ctrl G (Edit.com uses Ctrl + P to tell it the next key is a control key). In Windows use
mplayer2 /play /close C:\WINDOWS\MEDIA\NOTIFY.WAV
copy *.* c:\windows\temp > NUL
Copies all files in the current directory, and sends all text from the copy command to the NUL device rather than the screen. The NUL device just swallows whatever is sent to it.
copy *.* NUL > nul
Copies all files in the current directory to the NUL device. This tests all files can be read, great for floppies. The NUL device just swallows whatever is sent to it.
Every directory has a copy of the special file NUL. So to test for a directory test for the file NUL in that directory.
If exist c:\windows\nul <command to do>
If the directory c:\windows exists then the result is true.
to debug make sure that echo is set to on in the batch file, then to debug the batch file in the next section use
command.com /y /z /k sysed
where sysed is the batch file to be debugged and specify a path to it if necessary.
This is my system file editing batch file.
Echo SysEd - System File Editor
Echo Loads common configuration files or log files.
Echo SysEd /? or SysEd /L
If "%1"=="/?" Goto Help
If "%1"=="/h" Goto Help
If "%1"=="/H" Goto Help
If "%1"=="/help" Goto Help
If "%1"=="help" Goto Help
If "%1"=="HELP" Goto Help
If "%1"=="/l" Goto Logfile
If "%1"=="/L" Goto Logfile
If "%1"=="log" Goto Logfile
If "%1"=="LOG" Goto Logfile
If "%1"=="/log" Goto Logfile
If "%1"=="/LOG" Goto Logfile
If "%1"=="-?" Goto Help
If "%1"=="-h" Goto Help
If "%1"=="-H" Goto Help
If "%1"=="-help" Goto Help
If "%1"=="-HELP" Goto Help
If "%1"=="-l" Goto Logfile
If "%1"=="-L" Goto Logfile
If "%1"=="-log" Goto Logfile
If "%1"=="-LOG" Goto Logfile
attrib -r -s -h c:\msdos.sys
edit win.ini system.ini control.ini scanreg.ini .\command\scandisk.ini c:\autoexec.bat c:\config.sys c:\msdos.sys dosstart.bat
attrib -r +s +h c:\msdos.sys
edit sfclog.txt smwiz.log schedlog.txt c:\scandisk.log c:\bootlog.txt c:\detlog.txt "C:\Program Files\Plus!\Viruscan\VSHLog.txt"
Echo SysEd.Bat [/L] [/?]
Echo /L Load log files
Echo /? This message
Echo Loads (without switches)
Echo Win.ini, System.ini, Control.ini, Scanreg.ini, Scandisk.ini
Echo Autoexec.bat, Config.Sys, Msdos.sys, Dosstart.bat, Winstart.bat
Echo Loads (with the /l switch)
Echo sfclog.txt, smwiz.log, vshlog.txt, schedlog.txt, scandisk.log
Echo bootlog.txt, detlog.txt
If you need a Dos mouse driver, Microsoft Mouse Driver Ver 10 is available from ftp://ftp.microsoft.com/Softlib/MSLFILES/msmouse.exe. This will work with almost all mouses.
Most recent mouse drivers are TSRs type drivers. This means they can be installed from the command line rather than loaded in config.sys. Usually only the program's name needs to be typed. With the Microsoft driver if it is unable to find the mouse try mouse /f to force extra searching. If it still fails (and it's rare that typing anything other than mouse is required) type mouse /? to see how to specify exactly where the mouse is connected.
If you place the command in a file called Dosstart.bat in C:\Windows then it will run automatically whenever you chose Exit to MS-Dos.
If you need Dos Networking the old Dos Networking Client only (all you need to read files on another computer) is available from;
Get the following files for client/server;
For a user friendly interface in Dos get;
Don't mix up the files with windows as many have the same name. Query in MS support site on this term msdos AND wgao for help.
The Dos 6.22 suplemental disk is available from;
This includes Dosshell a mouse driven file manager, taskswapper, and program launcher. This is Explorer's Great Grandparent. Dosshell does not need setver to run. Dosshell works best with a mouse. Dosshell cannot run programs by choosing run or by double clicking a file (document or executable) in Windows 95 or 98, but still makes a good file manager and viewer.
Many other utilities are available including AccessDOS (a package of MS-DOS extensions for persons with motion and hearing disabilities), and Edlin (a editor that can be controlled from batch files).
You'll need to use Setver before most of these utilities will run. Setver is documented in msdosdrv.txt in the windows directory. To use Setver with edlin type;
setvet edlin.exe 6.22
When Windows 95 was first released OLDDOS (a directory on your Win98 CD-Rom) contained undelete, memmaker, and interlink (like Direct Cable Connection) among other programs. When FAT 32 was introduced most of the programs were removed from OLDDOS because they don't work on FAT 32 drives (but they do work on floppies). The original OLDDOS is available from;
If you have FAT16 drives read the resource kit (on the Win 98 CD-Rom) before using these utilities as you can lose your long file names. Though Memmaker should be fine on any drive (Microsoft doesn't want anyone using Dos so they can remove it from the next version of Windows 9.x).
You'll need to use Setver before most of these utilities will run. Setver is documented in msdosdrv.txt in the windows directory.
Doskey has a number of undocumented command line switches, /appedit enables Doskey in programs other than the command prompt.
If you don't know why you'd want to restore or backup a boot sector then don't do it. If you get it wrong you may render all your drives on this disk unusable.
This is used by people who have multiple operating systems or wierd requirements. It's not useful for 99.9999% of computers.
To repair a boot sector use Scandisk, Sys command, or FDisk /mbr. If your partition table (part of the boot record) gets scrambled only scandisk might help. Don't run Sys or FDisk /mbr with a damaged partition table.
Backing up is safe enough (as long as you follow the instructions exactly, then check each line before pressing enter), but restoring is dangerous.
If you are thinking of doing this because you think it's an extra safety step then it's not needed as Fat32 drives back up their own boot sectors.
And again, you may notice the lack of warnings on this site compared to other similar sites, so this warning should be considered important rather than a general disclaimer.
The boot sector contains a computer program that loads Dos or Windows. It also contains the partition table.
Virus checking in the BIOS or by programs must be disabled to write to a boot sector. Windows also prevent programs writing to the boot sector.
To create a backup of your boot sector and partition table type the following lines at in MSDos mode. Bold text shows the prompt and should not be typed but is what you can expect to see. Text in italics also aren't typed but are instructions or explainations to you.
C:\WINDOWS>lock c: WARNING: The LOCK command enables direct disk access by programs that can CORRUPT file names and/or DESTROY disk data, resulting in the loss of files on your disk. Are you sure (Y/N)?Y C:\WINDOWS>debug -L 0100 3 0 1 The second parameter is the drive we're backing up, we're doing C here, 3=C 1=A 2=B 4=D ect -rcx CX 0000 :200 enter 200 (200 hex = 512 bytes the size of the boot sector, CX control how many bytes we'll write to file) -n a:\bootsect.bak the name of the file to backup the boot sector to -w write 200h or 512 bytes to a:\bootsect.bak -q quit debug C:\WINDOWS>unlock c:
To view your boot sector press D<enter> 4 times after the L 0100 3 0 1 line. All boot sectors end with 55 AA in hex.
To check that the file is probably OK make sure it's size is 512 bytes exactly, then view it in Edit with the following command line;
edit /78 /r a:\bootsect.bak
the last two characters should be U (55) followed by a right angle (AA) with the corner in the upper right.
To restore a backup of your boot sector and partition table type the following lines in MSDos mode. Bold text shows the prompt and should not be typed but is what you can expect to see. Text in italics also aren't typed but are instructions or explainations to you.
C:\WINDOWS>lock c: WARNING: The LOCK command enables direct disk access by programs that can CORRUPT file names and/or DESTROY disk data, resulting in the loss of files on your disk. Are you sure (Y/N)?Y C:\WINDOWS>debug -n a:\bootsect.bak the name of the file that contains backedup the boot sector -L load the file specified by n -rcx CX 0200 check that it says 0200, if not quit (press enter, the Q, then enter) - something is wrong with the file or it wasn't loaded (200 hex = 512 bytes the size of the boot sector, CX contains how many bytes we read from the file) :Press enter this leaves CX unchanged -W 0100 3 0 1 The second parameter is the drive we're restoring to, we're doing C here, 3=C 1=A 2=B 4=D ect -q quit debug C:\WINDOWS>unlock c:
To view your boot sector before writing it press D<enter> 4 times after the L line. All boot sectors end with 55 AA in hex.