所以在这批中我想做
set /p pv="2.1.5"
echo Program V : %pv%
set /p rn="0.0.1 [Initial Release] , 0.0.2 [Some Blah]"
echo %rn%
set /p rn2="1.1.3 [New Things, Bug Fix & Improvements] , [2.1.5 Stuff]"
echo %rn2%
但不起作用。输出只是
2.1.5 计划五 0.0.1 [初始版本],0.0.2 [一些废话] ECHO 已关闭。 1.1.3 [新内容,错误修复和改进],[2.1.5 内容]
我使用它的原因是,当我需要在其他地方显示程序版本时,我不能从头开始输入所有内容,而只需将
%pv% and %rn% or %rn2% ..
答案1
如果你仔细阅读输出,答案很简单set /?
:
SET /P variable=[promptString]
The /P switch allows you to set the value of a variable to a line of input
entered by the user. Displays the specified promptString before reading
the line of input. The promptString can be empty.
省略所有/p来自放命令并感到惊讶。:)