I have to write a batch file with a environment variable a param:
c:\myapp.exe -f "%APP_HOME%\file.conf"
I need to pass exactly the string %APP_HOME%
as param and not its value. How can I do?
In other words, I don't want to strip the variable in the batch runtime but I would like to let the application use it as parametrized path, if I change this environment variable I don't want to change the variable in the application.
Answer
I need to pass exactly the string "%APP_HOME% as param
- Replace
%
with^%
Remove the
"
sc:\myapp.exe -f ^%APP_HOME^%\file.conf
test.cmd:
@echo %1 %2 %3
output:
F:\test>test c:\myapp.exe -f ^%APP_HOME^%\file.conf
c:\myapp.exe -f %APP_HOME%\file.conf
F:\test>
No comments:
Post a Comment