我知道这可能很愚蠢,而且无论如何我都不是专家级的批处理程序员,但我遇到了一个小问题。
我从我的备份脚本中剥离了备份功能(效果很好),并试图将其作为格式化脚本。代码包括:
@echo off
title CrucialBlue Simple Format Utility
echo Drives will be formatted, and all data will be lost! Please ensure the drive letter you chose is correct before continuing
echo Retrieving list of disk locations...
wmic logicaldisk get caption,volumename,providername
echo.
set /p drive=Enter only the drive letter of the drive you're attempting to format:
set /p form=Enter a file system to use (NTFS/FAT/FAT32):
echo.
IF EXIST %drive% format %drive%: /q fs:%form%
IF NOT EXIST %drive% echo Your drive was not formated because the drive you entered does not exist.
echo.
echo Program completed. Press any key...
pause > nul
我认为问题出在我的 IF EXIST 语句中,其中实际函数调用了这两个变量......有人有什么想法吗?