ITEEDU

范例

如果计算机只有一个软盘驱动器(例如,驱动器 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