我试图批量执行此操作。我知道如何在特定行中获取特定字符串。但我的问题是:有没有办法只获得该行中指定的字符串?我用来获取特定行的代码是:
:64BIT
@echo on
cd /D "C:\"
dir curl_for_64bit.exe /S > "%USERPROFILE%\Documents\reply.txt"
cd /D "%USERPROFILE%\Documents\"
for /F "skip=3 delims=" %%G in (reply.txt) do (
set "var=%%G"
)
存储在reply.txt中的输出是:
Volume in drive C has no label.
Volume Serial Number is 901C-31D8
Directory of C:\Users\onlYUs\Documents\jezreel\64BIT
08/24/2016 05:26 PM 2,140,672 curl_for_64bit.exe
1 File(s) 2,140,672 bytes
Total Files Listed:
1 File(s) 2,140,672 bytes
0 Dir(s) 126,741,708,800 bytes free
我想要的是获取“C:\ Users ...目录”行并删除字符串“Directory of”
我之所以想要获取路径的原因是:一旦curl_for_64bit.exe的位置,回复将存储在reply.txt中并获得与C:\ Users ...的行,以便批处理可以立即切换到该目录。