Batch file 使用if-else语句在for循环中询问用户输入
我使用下面的脚本查找系统中的固定驱动器,如果用户想要继续,他/她必须输入一个特定的字母。但是我无法运行这段代码,非常感谢您的帮助Batch file 使用if-else语句在for循环中询问用户输入,batch-file,Batch File,我使用下面的脚本查找系统中的固定驱动器,如果用户想要继续,他/她必须输入一个特定的字母。但是我无法运行这段代码,非常感谢您的帮助 @echo off for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do ( for %%c in (%%b) do ( for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do ( if %%d equ Fixed
@echo off
for /F "tokens=1*" %%a in ('fsutil fsinfo drives') do (
for %%c in (%%b) do (
for /F "tokens=3" %%d in ('fsutil fsinfo drivetype %%c') do (
if %%d equ Fixed (
echo %%c is a Fixed Drive
set /p ent= Enter e to continue=
if %ent%==e (goto DRIVE)else (goto INT)
)
)
)
)
您需要使用延迟扩展和此语法-请注意
!变数代码>
if /i !ent!==e (goto DRIVE) else (goto INT)