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.
我想在批处理编程中将命令的输出存储在变量中请帮助我..提前谢谢..
就像我想将 find 命令的输出存储在变量 p set p=find /c "chi*" "file.txt"
假设您要存储行数而不是 find 产生的整行输出
for /f "tokens=3" %%i in ('find /c "chi*" "file.txt"') do set p=%%i
注意:要存储整行,您可以使用tokens=*或delims=(等号后没有空格!)。
tokens=*
delims=