I want to echo this text:cd %~dp0 unchanged to my text file.
but when I run:
echo cd %~dp0>new_file.txt
It stores the result of the cd command in the text file.
Since double quotes dont work, how can i echo this without executing the command cd?
I want to echo this text:cd %~dp0 unchanged to my text file.
but when I run:
echo cd %~dp0>new_file.txt
It stores the result of the cd command in the text file.
Since double quotes dont work, how can i echo this without executing the command cd?
In batch, you escape % by adding a second % in front of it.
echo cd %%~dp0>new_file.txt
If all you are doing is trying to save a current directory (where your batch file is) to a text file just run this.
cd>new_file.txt