SoFunction
Updated on 2025-04-07

Undisclosed commands and parameters in MS-DOS

There are many undisclosed commands and parameters in the DOS system. After collecting and sorting, I found a lot. Since there are several types of DOS, the following is to only take MS-DOS as an example to introduce undisclosed commands and parameters in common commands. After comparison, I found that among the various versions of MS-DOS, the unpublished commands and parameters in the version have the most. The unpublished commands and parameters in these versions are usually not available in other DOS versions, but they are very practical, such as the COMMAND/Z command, which is the only way to display the ERRORLEVEL (Error Return Code) value using the commands that come with DOS (of course, it can also be done with other additional tools, such as ERR2ENV, etc.).

Until version 6.22, MS-DOS still retains many undisclosed commands and parameters. The following is an introduction to these commands and parameters.

Used to display the actual physical location of files and directories when using SUBST, JOIN commands, or mapping physical disks to logical disks on the network.

/MBR

Rewrite the hard disk master boot record. Note: If there are more than four hard disk partitions, this command cannot be used, because the area that stores additional partition information will be overwritten by FDISK/MBR. (Not to use it for beginners)

=C:\/P/F

After adding the /F parameter, when an error message is prompted by "Abort, Retry, Fail", Fail will be used as the default option.

/F

When executing the command line, make Fail the default option for the error message prompt of "Abort, Retry, Ignore, Fail" until restarted. After executing this command in the DOS shell of other dedicated DOS shells (such as NDOS, 4DOS, etc.) or applications (such as PCTOOLS, CCED, etc.), it will return and stay in the MS-DOS shell. EXIT must be executed to return to the second shell.

/P

When executing at the command line, rerun. If you execute this command in other DOS shells, you will return to the MS-DOS shell and cannot return to the second shell.

/D

When executing at the command line, prevents the running of automatic batch files. The same situation as COMMAND/F is run in other DOS shells, but Fail is not set as the default option.

/R

Show more information. For example, if you execute VER, display "MS-DOS Version 6.22". After adding parameters /R, you will display: MS-DOS Version 6.22 Revision A DOS is in HMA

/AUTOTEST

Automatically check the disk format, then complete the formatting process, and then return to the DOS prompt.

/BACKUP

Except for prompting the user to enter the volume label, it is the same as above.

/SELECT

Only backing up system area data on disk is equivalent to executing the MIRROR program without formatting.

/SELECT/U

No formatting is done, only the boot area and file allocation table are filled in with F6H. Although the root directory area and data area are not touched, the disk is therefore inaccessible. This seems to provide an emergency measure to prevent data leakage. (Not to use it for beginners)

EXIST EMMXXXXO

The command name is used for batch files to detect whether there is any in memory. Example of command statement: "if not exist EMMXX XXO echo is not installed!".

EXIST XMMXXXXO

The command name can detect whether the memory is installed in the batch file. The command line can be: "if not exist XMMXXX XO echo is not in memory!".

. A:

Use "." instead of "*.*", and can also be used for commands such as DEL.

Some device drivers need to be installed using INSTALL statements in it, and can only be loaded into regular memory. Moreover, when using MEMMAKER to optimize memory, the INSTALL statement is not processed. You can use INSTALLHIGH to load this type of device driver into upper memory instead, for example: INSTALLHIGH=C:\DOS\.

16. Use ":" instead of "REM"

When executing batch files in DOS, when encountering a "REM" statement, first read the entire sentence, and then decide the processing method based on whether there is REM at the beginning of the sentence; when encountering a label starting with ":", as long as the second character is not a letter or a number, it will be considered an invalid label and immediately jump to the next line. Therefore, you can use ":" plus a space to guide the comment line to increase the execution speed of batch files.

DOS undisclosed command

TRUENAME: Used to display the actual path, useful for commands such as SUBST.
INSTALLHIGH: Used in, and transfer files to UMB.
LOGO and COMMENT: Only used in MS-DOS, the usage is unknown.

DOS undisclosed parameters:

COMMAND /F Make Fail as the default option in Abort, Retry, Fail.
COMMAND/D is prohibited from automatic execution in DOS5; in version 6.0+, the /F parameter is prohibited.
COMMAND /Z Display ERRORLEVEL (Error Return Code) information.
COMMAND/T Force permanently to be tuned into regular memory in MS-DOS.

FORMAT/AUTOTEST Automatically complete the formatting process.
FORMAT/BACKUP automatically completes the formatting process and prompts to enter the volume label.
FORMAT/SELECT only backs up system area data on disk, which is equivalent to the MIRROR program.
FORMAT/SELECT/U Fill in the boot area and file allocation table with F6H.
FORMAT/Z:n Sets the cluster size on the FAT32 partition.

FDISK/MBR rewrites the hard disk master boot record.
FDISK/CMBR drive rewrites the master boot record on the specified drive.
FDISK /PRI:size Create the primary partition.
FDISK /EXT:size Create an extended partition.
FDISK/LOG:size Creates a logical drive on the extended partition.
FDISK /PRMT|/Q Prompt Action/Quiet Mode.
FDISK/PARTN saves partition table information to.
FDISK/ACTOK is used in MS-DOS, skipping integrity testing.
FDISK/FPRMT is used in MS-DOS, and FAT32 is automatically used and the prompt information is skipped.

DOSKEY/APPEDIT enables DOSKEY to be applied to other programs (such as DEBUG, etc.).
The usage of DOSKEY/COMMAND and/PERMANENT and/SCRSIZE and/XHISTORY is unknown.

SCANDISK/CLIP is used in MS-DOS, and the long file name is cut into a short file name.
SCANDISK/NOLOST is used in MS-DOS and does not prompt surface testing or cluster loss.
SCANDISK/NOUI and/TEXT are used in MS-DOS, using standard DOS interfaces.
SCANDISK/MOUNT is equivalent to Mount=Always in the same.
SCANDISK/TIME is equivalent to ScanTimeOut=On.

QBASIC/QHELP Entering the full-screen help system of DOS is equivalent to executing HELP commands.
QBASIC/EDCOM Entering the file editor of DOS is equivalent to executing EDIT commands.

MEM /A or MEM /ALL displays HMA information.

VER /R displays extended version information.

DIR /Z is used in MS-DOS, indicating that long file names are not displayed.

DEVICE=/Q Use quiet mode when loading.

DEVICE= NOTR Do not detect the Token Ring network adapter.

DOS undisclosed usage:

IF EXIST XMSXXXX0 ... This command can determine whether the XMS memory manager is currently installed (usually). Note: It is XMSXXXX0, not the wrong XMMXXXX0 mentioned in some articles.
IF EXIST EMMXXXX0 ... This command is used to determine whether the EMS memory manager is currently installed (usually).

:: This symbol can replace REM annotation commands in batch files, which can speed up the operation.

The above are unpublished commands and parameters in MS-DOS, some of which are very practical, so you might as well give it a try.