Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文本文件,其中有两个变量 CVERSION=1.0.0.0 和 PVERSION=1.0。我希望 bach 脚本将这两个变量分别读取到批处理文件中的变量 DVERSION 和 PVERSION 中。我怎样才能做到这一点?
您可以将 findstr 与 FOR /F 循环结合使用。
FOR /F "usebackq tokens=2 delims==" %%V in (`FINDSTR CVERSION myFile.txt`) DO ( set "myCVersion=%%V" ) echo %myCVersion%