我正在嘗試創建交互式bat文件,該文件詢問文件夾的詳細信息,它可以採用userchoice,但之後無法設置useri.e提供的文件夾路徑。它需要的路徑,直到桌面only.Below是我的代碼相同:set/p未按預期工作
@echo off
set /p UserInfo= "Do you have abc software(y/n)? "
echo %UserInfo% // here it is working as expected
IF %UserInfo%==y (
echo "Reply is true-----"
set /p Path= "Please enter path for abc directory? "
echo %Path% //but here it takes the path till the desktop only(C:\user\username\Desktop)
CD %Path%
dir
set /p Path1= "Please enter path1 directory path provided in package? "
echo %Path1% //but here it takes the path till the desktop only(C:\user\username\Desktop)
CD %Path1%
)
IF %UserInfo%==n (
echo "Reply is False**************"
)
pause
如何讀取文件夾指令?
使用頂部欄中的「搜索」工具來查找對「延遲擴展」的引用 - 它是#1 FAQ。 – Magoo
設置和使用(代碼塊)內的變量時,您需要[延遲擴展](http://s64.com/nt/delayedexpansion.html)。 – LotPings
LotPings可以請你提供代碼嗎? –