Programming Field

Diskcopy - DOS/Command Prompt Reference

[MS-DOS, and Windows NT series up to Windows 8.1] Copies the entire contents of a floppy disk to another disk.

Syntax

diskcopy[.com] [<drive-letter1>: [<drive-letter2>:]] [/V] [/1] [/M]
<drive-letter1>: Specifies the source floppy disk drive to be used when copying a floppy disk (drive letter and ‘:’ are required). If omitted, the current drive will be used.
<drive-letter2>: Specifies the drive to be used as the destination for copying the floppy disk. If omitted, the current drive will be used. Additionally, if ‘<drive-letter2>:’ (default is the current drive when omitted) is the same drive as ‘<drive-letter1>:’, a prompt will be displayed (as needed, several times) during the process to request disk replacement.
/V Checks whether the data is accurately written to the disk each time during copying. Specifying this switch will increase processing time.
/1 [MS-DOS] Specifies to copy only one side even if the disk is double-sided.
/M [MS-DOS] When copying a disk, only conventional memory is used as a temporary storage location. If this option is not specified, a temporary file will be created in the location specified by the TEMP environment variable. In this case, the drive pointed to by TEMP must have a certain amount of free space. However, when using only conventional memory for temporary storage, there may be an increase in the frequency of disk replacement if the source and destination drives are the same, due to constraints on the size of data that can be temporarily kept in conventional memory.

Details

Diskcopy copies the floppy disk on a track-by-track basis. You cannot specify a drive other than a floppy disk drive for the drive designation. Unlike when using commands like Copy or Xcopy, this method preserves the original positions of files within the disk, performing a complete copy including files used for booting. Therefore, if the source disk is a boot disk, the destination disk will also become a boot disk.

[Windows 10 and later] In Windows 10 and later, Diskcopy program is not available, possibly due to the discontinuation of support for floppy disks.

If the destination disk is not formatted, the program will format the disk using the same format as the source disk. Additionally, a new volume serial number will be created on the destination disk, regardless of whether it is already formatted or not. However, if the destination disk has a smaller capacity than the source disk, the copy operation will fail and not be executed.

[MS-DOS] Even if the source and destination drives are the same, it is possible to copy the disk while intermittently swapping disks. In this case, temporary files are created in the location specified by the TEMP environment variable (using only conventional memory if /M is present), and the copy operation is performed. If the capacity of the destination for keeping data is somewhat insufficient, the frequency of disk swaps may increase because only that amount of data can be kept. If you want to reduce the frequency of swaps, specify a directory with ample free space on a drive as the TEMP directory.

[Windows NT series] If the source and destination drives are the same, the temporary location used for keeping data will be the current drive. Therefore, before executing Diskcopy, move to a location on a different drive than the one used for copying.

Since Diskcopy performs a complete copy of the disk, if fragmentation occurs on the source disk, the same fragmentation will occur on the destination disk. To avoid fragmentation, it is recommended to use Copy or Xcopy instead of Diskcopy (although due to file arrangement, there is a possibility that even if the source is a boot disk, the destination may not become a boot disk).

Diskcopy returns an exit code, allowing for conditional checks in batch files using If Errorlevel. The exit codes are as follows:

CodeMeaning
0The copy operation has completed successfully.
1During the copy operation, non-fatal read/write errors occurred.
2The copy process was interrupted by the input of Ctrl+C, and the operation has been aborted.
3Irrecoverable error occurred (such as fatal hardware-related error).
4An error occurred during the initialization process.

Samples

C:
diskcopy A: A:

The copy of the floppy disk will be performed using only the A drive. Disk replacement will be necessary at some point during the process.

[Windows NT series] To temporarily store data, drive relocation, as indicated in the first line, will be necessary.