I want to create simply batch script to copy my folders from my user profile to NAS using robocopy. I have written the script but it is not working. I have two files one is the script and second is the text file where I will put the folder paths to be copied to NAS. The scipt will use this text file. Following are the code snippets,
batch file:
@echo off
for /f "tokens=*" %%v in (dir.txt) do (
echo:%%v
robocopy %%v h:\
)
text file (dir.txt)
"%userprofile%\desktop"
"%userprofile%\downloads"
"%userprofile%\My Documents"
"%userprofile%\Documents"
"%userprofile%\Favorites"
the batch script is unable to process file names from variable.
Thanks
Forgive me if this answer is naive, but can you alter the source file? If it was simply this:
You could use this batch file:
If there is some reason that the userprofile of the one executing the command does not work, maybe make a batch program that generates the initial input file with the correct paths already spelled out.