batch-filecmduser-profilefile-move

Moving a file to another directory in Batch using %USERPROFILE%?


So, I have a folder with two files in it, Test.cmd, and Test.txt. I'm trying to move Test.txt to another directory using the Test.cmd file with %USERPROFILE%. Here's my code so far:

move "%d%Test.txt" "%USERPROFILE%AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"

The output read: The system cannot find the file specified.

I tried adding ' \ ' after the %d% and %USERPROFILE% but that was no use.


Solution

  • I think you should write something like that :

    Move "%~dp0Test.txt" "%Appdata%\Microsoft\Windows\Start Menu\Programs\Startup"