diskcomp

比较两个软盘的内容。 如果不带参数使用, diskcomp 使用当前驱动器来比较两个磁盘。

Syntax

diskcomp [<drive1>: [<drive2>:]]

Parameters

Parameter Description
<drive1> 指定包含其中一个软盘的驱动器。
/? 在命令提示符下显示帮助。

Remarks

  • diskcomp 命令仅适用于软盘。 不能将 diskcomp 与硬盘一起使用。 如果为 drive1drive2 指定硬盘驱动器,则 diskcomp 将显示以下错误消息:

    Invalid drive specification
    Specified drive does not exist
    or is nonremovable
    
  • 如果要比较的两个磁盘上的所有轨道都相同(它忽略磁盘的卷号), diskcomp 会显示以下消息:

    Compare OK
    

    如果轨道不相同, diskcomp 会显示类似于以下内容的信息:

    Compare error on
    side 1, track 2
    

    diskcomp 完成比较时,它会显示以下消息:

    Compare another diskette (Y/N)?
    

    如果按 Y,diskcomp 会提示您插入磁盘以进行下一次比较。 如果按 N,diskcomp 将停止比较。

  • 如果省略 drive2 参数,则 diskcomp 将当前驱动器用于 drive2。 如果省略这两个驱动器参数,则 diskcomp 将当前驱动器用于这两个参数。 如果当前驱动器与 drive1 相同,则 diskcomp 会提示您根据需要交换磁盘。

  • 如果为 drive1drive2 指定相同的软盘驱动器,则 diskcomp 会使用一个驱动器对它们进行比较,并根据需要提示您插入磁盘。 可能需要多次交换磁盘,具体取决于磁盘的容量和可用内存量。

  • Diskcomp 无法将单面磁盘与双面磁盘进行比较,也无法将高密度磁盘与双密度磁盘进行比较。 如果 drive1 中的磁盘与 drive2 中的磁盘类型不同,则 diskcomp 会显示以下消息:

    Drive types or diskette types not compatible
    
  • Diskcomp 不适用于网络驱动器或由 subst 命令创建的驱动器。 如果尝试将 diskcomp 与其中任何类型的驱动器一起使用, diskcomp 将显示以下错误消息:

    Invalid drive specification
    
  • 如果将 diskcomp 与使用 复制创建的磁盘一起使用,则 diskcomp 可能会显示类似于以下内容的消息:

    Compare error on
    side 0, track 0
    

    即使磁盘上的文件相同,也会发生此类错误。 尽管 复制 会重复信息,但它不一定会将其放置在目标磁盘上的同一位置。

  • diskcomp 退出代码:

    Exit code Description
    0 磁盘相同
    1 发现差异
    3 发生硬错误
    4 初始化错误发生

    要处理 diskcomp 返回的退出代码,可以在批处理程序的 if 命令行上使用 ERRORLEVEL 环境变量。

Examples

如果计算机只有一个软盘驱动器(例如驱动器 A),并且你想要比较两个磁盘,请键入:

diskcomp a: a:

Diskcomp 会根据需要提示您插入每个磁盘。

说明如何在 if 命令行上使用 ERRORLEVEL 环境变量的批处理程序中处理 diskcomp 退出代码:

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