How to make a batch program duplicate itself to a different folder?
I tied this but it did not delete the move file:
echo copy script.bat F:\ > move.bat
move.bat
del move.bat
How to make a batch program duplicate itself to a different folder?
I tied this but it did not delete the move file:
echo copy script.bat F:\ > move.bat
move.bat
del move.bat
You need only this:
copy "%~f0" "F:\"
See more about the parameter expansion here.The reason why your code didn't worked because you hadn't used call
when you were executing move.bat
(check this). And it is a bad idea to name your bats on already existing commands because at some point you can't know what exactly will be executed.