Diskcomp command in Windows
The diskcomp command compares the content of two floppy disks. If used without parameters, the diskcomp command will use the current drive to compare both disks. To learn how to use this command, please see the Example below.
Diskcomp command in Windows
- The syntax of the commandcomp command
- Parameters
- Note
- For example
The syntax of the commandcomp command
diskcomp [: [:]]
Parameters
ParameterDescription Specifies the drive that contains one of the floppy disks. Specify a drive that contains another floppy disk. /? Show help at the command prompt.Note
- Use the disk
The diskcomp command only works with floppy disks. You cannot use the diskcomp command with a hard disk. If you specify the hard drive for Drive1 or Drive2, the diskcomp command will display the following error message:
Invalid drive specification Specified drive does not exist or is nonremovable
- Compare the discs
If all content on the two disks compared is the same, the diskcomp command will display the following message:
Compare OK
If the contents are not the same, the diskcomp command will display a message similar to the following:
Compare error on side 1, track 2
When the diskcomp command completes the comparison, it displays the following message:
Compare another diskette (Y/N)?
If you click Y , the diskcomp command prompts you to insert a disk for the next comparison. If you press N , the diskcomp command will stop comparing.
When diskcomp performs a comparison, it ignores the partition number of the drive.
- Ignore the drive parameters
If you omit the Drive2 parameter , the diskcomp command will use the current drive for Drive2. If you omit both drive parameters, the diskcomp command will use the current drive for both. If the current drive is the same as Drive1, the diskcomp command will prompt you to change the location of the disks as needed.
- Use a drive
If you specify the same floppy drive for Drive1 and Drive2, the diskcomp command compares them using a drive and prompts you to insert the disk if needed. You may have to change the disks multiple times, depending on the capacity of the disk and the amount of available memory.
- Compare different disc types
Diskcomp cannot compare single-sided singles with double-sided discs, as well as high-density (high-density) discs with double-density disks. If the disk in Drive1 is not the same type as the disk in Drive2, the diskcomp command will display the following message:
Drive types or diskette types not compatible
- Use diskcomp commands with network and redirection drives
Diskcomp does not work on a network drive or on a drive created by the subst command . If you try to use the diskcomp command with a drive of any of these types, the diskcomp command will display the following error message:
Invalid drive specification
- Compare the original disc with the copy
When you use the diskcomp command with a disk you have made using the copy command , the diskcomp command may display a message similar to the following:
Compare error on side 0, track 0
This type of error can occur even if the files on the disk are identical. Although the copy command copies information, it doesn't necessarily have to put that information in the same location on the target disk.
- Understand the exit code of the diskcomp command
The following table explains each exit code.
Exit code Description0 The disks are the same. 1 There is a difference. 3 A fatal error has occurred. 4 An initial error has occurred.To process exit codes returned by the diskcomp command , you can use the environment variable ERRORLEVEL on the if statement in a batch program.
For example
If your computer has only one floppy drive (for example, drive A) and you want to compare two disks, enter:
diskcomp a: a:
Diskcomp prompts you to insert each disk, if necessary.
The following example illustrates how to handle the exit code of the diskcomp command in a batch program using the ERRORLEVEL environment variable on the if statement:
rem Checkout.bat compares the disks in drive A and B echo off diskcomp a: b: if errorlevel 4 goto ini_error if errorlevel 3 goto hard_error if errorlevel 1 goto no_compare if errorlevel 0 goto compare_ok :ini_error echo ERROR: Insufficient memory or command invalid goto exit :hard_error echo ERROR: An irrecoverable error occurred goto exit :break echo "You just pressed CTRL+C" to stop the comparison goto exit :no_compare echo Disks are not the same goto exit :compare_ok echo The comparison was successful; the disks are the same goto exit :exit
See more:
- Dcgpofix command in Windows
- Defrag command in Windows
- Del command in Windows
You should read it
Maybe you are interested
What to do when open command window here does not appear?
How to switch users on the Linux command line
How to fix Mac Homebrew error 'zsh: command not found: brew'
What is the Command key on Windows?
How to use read command in Linux
Basic Linux commands everyone needs to know - Operations on Linux are much faster