
[已解決]批處理如何轉(zhuǎn)換for/f提取文本中帶環(huán)境變量的路徑為實際對應(yīng)路徑如圖所示:Test.txt 文本中的第一列是帶環(huán)境變量的路徑(如:%UserProfile%Desktop) 第二列是文件名(如:Test.exe)那么:
此時的%%a是字符串形式的 %UserProfile%Desktop 而不是對應(yīng)的 C:Users[用戶名]Desktop,請問這種情況要如何轉(zhuǎn)換為實際路徑,使后面的刪除文件命令可以執(zhí)行成功?nload="thumbImg(this)" alt="" />nload="thumbImg(this)" alt="" />nclick="copycode($('code0'));">復(fù)制代碼
- for /f skip=1 tokens=1,2 %%a in (Test.txt) do if exist %%a%%b del /q %%a%%b

