Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
@echo off
echo  %DATE%,%TIME%,%USERNAME%,%COMPUTERNAME% >>  \\\Users\migrate.log
mkdir  P:\Saved-%computername%\
net use > P:\Saved-%computername%\SPARES.txt
robocopy "%LIBRARIES%\Music" P:\Saved-%computername%\Music /E  /LOG:P:\Saved-%computername%\copylog.log  /np 
robocopy "%USERPROFILE%\Desktop"     P:\Saved-%computername%\Desktop /E /LOG+:P:\Saved-%computername%\copylog.log /np 
robocopy "%USERPROFILE%\Local Settings\Application Data\Microsoft\Outlook" P:\Saved-%computername%\Outlook *.pst /E /LOG+:P:\Saved-%computername%\copylog.log /np 
robocopy "%USERPROFILE%\" "P:\Saved-%computername%\PKCU  /E /LOG+:P:\Saved-%computername%\copylog.log /np 
robocopy "%LIBRARIES%\Pictures" "P:\Saved-%computername%\Pictures" /E /LOG+:P:\Saved-%computername%\copylog.log /np 
robocopy "%LIBRARIES%\Documents" "P:\Saved-%computername%\Documents" /E /LOG+:P:\Saved-%computername%\copylog.log /np 

I keep getting

ERROR 2 (0x00000002) Accessing Source Directory
The system cannot find the file specified.

For each directory/library. Is there something wrong with my script? Any information would be most appreciated. Thanks

share|improve this question

There is no %LIBRARIES% variable. Use %USERPROFILE% instead, which will point you to c:\Users\<username>. You can safely use english names (like Music) regardless of the locale.

Each "Library" is in fact a virtual folder that displays content gathered from (possibly) many different folders. By default, each user library has two folders attached:

  • %USERPROFILE%\<library_type>
  • %PUBLIC%\<library_type>

User may add any number of additional folders via library properties panel.

Take a note, that the solution I provided (using %USERPROFILE%) will not reach any additional folders you may have added to your libraries. On a default setup, though, it will work well.

share|improve this answer
ok thanks, I'm going to apply this and see the results...Thanks again! – k3i Apr 11 '13 at 17:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.