0

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.

One Bass Man
  • 37
  • 1
  • 1
  • 8

1 Answers1

0

I think you should write something like that :

Move "%~dp0Test.txt" "%Appdata%\Microsoft\Windows\Start Menu\Programs\Startup"
Hackoo
  • 18,337
  • 3
  • 40
  • 70
  • Hmm... Still can't find the file. I know it isn't a problem with the placements of the files because I added `start %d%Test.txt` and it opened successfully. – One Bass Man Dec 27 '20 at 23:39
  • @Datonebassdude What represente `%d%` for you ? – Hackoo Dec 27 '20 at 23:41
  • '%d%' is just the directory. in my case, '%d%' outputs as: 'C:\Users\username\OneDrive\Documents\Code' – One Bass Man Dec 27 '20 at 23:46
  • And what happens if you try like that ? `Move "C:\Users\josh\OneDrive\Documents\Code\Test.txt" "%Appdata%\Microsoft\Windows\Start Menu\Programs\Startup" ` – Hackoo Dec 27 '20 at 23:51
  • Ohhh... I see, I accidentally marked 'Test.txt' as a hidden file and that prevented it from being found by the script. Your answer worked. Thanks and apologies! Not sure why you can start hidden files but not move them though... – One Bass Man Dec 28 '20 at 00:08