[英]How to pass environment variables as parameters by reference to another batch file?
[英]How to pass parameters from a batch file to another as strings
因此标题可能不太清楚我想要的内容,但是基本上我有以下代码:
echo python %2 "%1" >> activate_wrapper.bat
这段代码位于.bat文件中,目的是构建另一个将运行python脚本的.bat文件。 问题是我不想将%1的值写入Activate_wrapper.bat,我想写入字符串“%1”。
Activate_wrapper.bat中的预期行:
python secondArg %1
我得到什么:
python secondArg "firstArg"
在此先感谢大家。
解:
echo python %2 %%1 >> activate_wrapper.bat
电脑无法读懂您的想法,也不知道您只想扩展其中一个参数!
您必须转义%
以防止扩展:
echo hello %2 "%%1" >> temp.txt
set something=whatever
echo hello %%something%% >> temp.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.