So the title may not be very explicit about what I'm looking for, but basically I have this code:
echo python %2 "%1" >> activate_wrapper.bat
This code is inside a .bat file and it's purpose is to build another .bat file that will run a python script. Thing is I don't want to write the value of %1 to activate_wrapper.bat, I want to write the string "%1".
Expected line in activate_wrapper.bat:
python secondArg %1
What am I getting:
python secondArg "firstArg"
Thanks in advance guys.
SOLUTION:
echo python %2 %%1 >> activate_wrapper.bat
The computer cannot read your mind, it doesn't know you only want to expand one of the parameters!
You must escape the %
to prevent expansion:
echo hello %2 "%%1" >> temp.txt
set something=whatever
echo hello %%something%% >> temp.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.