我有创建某些变量的批处理代码。但是,我想添加一个IF
语句,以便如果用户为第一个变量输入“Technology”,则会创建另一个变量并要求提供其他信息。一个python脚本然后读取这些变量进行进一步处理。如果IF语句返回true,如何设置新变量?
下面是代码:
set constraint_type=1
set constraint_technology=1
set /p constraint_type="Enter constraint type (E.g. "Equipment" or "Technology"): "
IF /I !constraint_type!=="Technology" set /p constraint_technology="Enter Technology name: "
cmd /k python "script.py" %constraint_type% %constraint_technology%
@echo on
代码运行,但不提示用户为constraint_technology
变量。我错过了什么吗?
'IF/constraint_type == “技术”'! - >'IF/I “%constraint_type%” == “技术”'(正常''%扩展和报价,以避免空入境麻烦) – aschipfl
@aschipfl - 真棒,感谢您的提示;) – Joseph