驱动器中没有磁盘。请将磁盘插入驱动器 \Device\Harddisk\DR5
There is no disk in the drive. Please insert a disk into drive \Device\Harddisk\DR5
问题是这样的:批处理程序正在尝试读取已插入或未插入闪存卡的 USB 驱动器。当其中有 none 时,会显示一条消息:
"There is no disk in the drive. Please insert a disk into drive \Device\Harddisk\DR5."
采用图形 Windows 样式。但是,那个时候,批处理程序停止了。
我不介意显示错误,但我不喜欢程序停止。
那么,我该如何解决这个问题。我无法探究它,比如通过使用 :
如果存在 X: ...
因为,是的,您已经猜到了,它也显示相同的错误,并停止批处理程序。我可以在后台模式下启动另一个批处理程序,然后让那个挂起,但这会很麻烦。
它让我想起了很多旧消息:中止、重试、失败
不过那是 DOS 框内的消息。
你可以试试
vol x: > nul
if errorlevel 1 echo drive does not exist or is not ready
像这样在 , you can use conditional execution 上构建:
>NUL 2>&1 vol x: && (
rem drive exists
) || (
rem drive does not exist
)
您还可以通过检查根目录中是否存在 NUL
来测试驱动器是否存在。
if exist x:\NUL (
rem drive exists
) else (
rem drive does not exist
)
我没有卡 reader,但我用没有光盘的 DVD 驱动器测试了它,它工作正常。
问题是这样的:批处理程序正在尝试读取已插入或未插入闪存卡的 USB 驱动器。当其中有 none 时,会显示一条消息:
"There is no disk in the drive. Please insert a disk into drive \Device\Harddisk\DR5."
采用图形 Windows 样式。但是,那个时候,批处理程序停止了。
我不介意显示错误,但我不喜欢程序停止。
那么,我该如何解决这个问题。我无法探究它,比如通过使用 :
如果存在 X: ...
因为,是的,您已经猜到了,它也显示相同的错误,并停止批处理程序。我可以在后台模式下启动另一个批处理程序,然后让那个挂起,但这会很麻烦。
它让我想起了很多旧消息:中止、重试、失败
不过那是 DOS 框内的消息。
你可以试试
vol x: > nul
if errorlevel 1 echo drive does not exist or is not ready
像这样在
>NUL 2>&1 vol x: && (
rem drive exists
) || (
rem drive does not exist
)
您还可以通过检查根目录中是否存在 NUL
来测试驱动器是否存在。
if exist x:\NUL (
rem drive exists
) else (
rem drive does not exist
)
我没有卡 reader,但我用没有光盘的 DVD 驱动器测试了它,它工作正常。