I can't figure out how to write "%PROGRAMFILES%"
literally to a file using Windows Command Prompt.
What I've tried:
C:\Users\lxvs> echo "%PROGRAMFILES%" > test
C:\Users\lxvs> type test
"C:\Program Files"
C:\Users\lxvs> echo ^%PROGRAMFILES^% > test
C:\Users\lxvs> type test
%PROGRAMFILES%
C:\Users\lxvs> echo "^%PROGRAMFILES^%" > test
C:\Users\lxvs> type test
"^%PROGRAMFILES^%"
C:\Users\lxvs> echo "%%PROGRAMFILES%%" > test
C:\Users\lxvs> type test
"%C:\Program Files%"
Is there a way to approach it?
Escape the quotes, so that the carets inside get parsed and removed.
C:\etc>echo ^"%^ProgramFiles%^" >test
C:\etc>type test
"%ProgramFiles%"
C:\etc>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With