title: How to: get batch script to log multiple robocopies
body: <p>For the life of me I cannot figure out how to get any form of output to go into a log file from my script. I have tried to log ROBOCOPY by using "/log+:". I could not get any output to log that way. So now I thought I might be able to use the redirect ">" or ">>". That is not working for me either and I have not found a solution that works for me yet. Any help is appreciated.</p>
  
  <pre><code>@Echo OFF
  setlocal EnableExtensions EnableDelayedExpansion
  REM Backup Script from Windows 7 to Windows 10
  REM Made By Adam Avila
  REM Date: 6/7/2018
  Set Destination="C:\Users\%Username%\BackupS2018"
  Set LogFile="%Destination%\Log"
  
  REM This part of the script sets the variables
  Set Desktop=C:\Users\%Username%\Desktop\
  Set Favorites=C:\Users\%Username%\Favorites\
  Set ChromeBookmarks="C:\Users\%Username%\AppData\Local\Google\Chrome\User Data\Default"
  Set FirefoxPath=C:\Users\%Username%\AppData\Roaming\Mozilla\Firefox\profiles\
  Set UProof=C:\Users\%Username%\AppData\Roaming\Microsoft\Uproof\
  Set Templates=C:\Users\%Username%\AppData\Roaming\Microsoft\Templates\
  Set SSH=C:\Users\%Username%\AppData\Roaming\SSH\
  Set Skype=C:\Users\%Username%\AppData\Roaming\Skype\
  Set FileZilla=C:\Users\%Username%\AppData\Roaming\FileZilla\
  Set Box=C:\Users\%Username%\AppData\Roaming\Box\
  Set Snagit=C:\Users\%Username%\AppData\Local\TechSmith\SnagIt\
  Set Cisco=C:\Users\%Username%\AppData\Local\Cisco\
  Set StickyNotes="C:\Users\%Username%\AppData\Roaming\Microsoft\Sticky Notes"
  Set NewStickyNotes=C:\Users\%Username%\AppData\Local\Packages\Microsoft.MicrosoftStickyNotes_8wekyb3d8bbwe\LocalState\Legacy\
  
  REM This part of the script restores data.
  If Exist %Destination% (
  If Exist %Destination%\Desktop (ROBOCOPY %Destination%\Desktop %Desktop% /S)
  If Exist %Destination%\Favorites (ROBOCOPY %Destination%\Favorites %Favorites% /S)
  If Exist %Destination%\ChromeBookmarks (ROBOCOPY %Destination%\ChromeBookmarks %ChromeBookmarks% /S)
  If Exist %Destination%\UProof (ROBOCOPY %Destination%\UProof %UProof% /S)
  If Exist %Destination%\Templates (ROBOCOPY %Destination%\Templates %Templates% /S)
  If Exist %Destination%\SSH (ROBOCOPY %Destination%\SSH %SSH% /S)
  If Exist %Destination%\Skype (ROBOCOPY %Destination%\Skype %Skype% /S)
  If Exist %Destination%\FileZilla (ROBOCOPY %Destination%\FileZilla %FileZilla% /S)
  If Exist %Destination%\Cisco (ROBOCOPY %Destination%\Cisco %Cisco% /S)
  If Exist %Destination%\Box (ROBOCOPY %Destination%\Box %Box% /S)
  If Exist %Destination%\Snagit (ROBOCOPY %Destination%\Snagit %Snagit% /S)
  If Exist %Destination%\StickyNotes (
  taskkill /im Microsoft.Notes.exe /t /f
  ROBOCOPY %Destination%\StickyNotes %NewStickyNotes% StickyNotes.snt /S)
  Rename %NewStickyNotes%\StickyNotes.snt ThresholdNotes.snt
  )
  
  ) &gt; "%LogFile%\RestoreLog.txt" Else (
  
  REM This part of the script backups data.
  If Exist %Desktop% (ROBOCOPY %Desktop% %Destination%\Desktop /S)
  If Exist %Favorites% (ROBOCOPY %Favorites% %Destination%\Favorites /S)
  If Exist %ChromeBookmarks%\Bookmarks (ROBOCOPY %ChromeBookmarks% %Destination%\ChromeBookmarks Bookmarks /S)
  If Exist %UProof% (ROBOCOPY %UProof% %Destination%\UProof /S)
  If Exist %Templates% (ROBOCOPY %Templates% %Destination%\Templates /S)
  If Exist %SSH% (ROBOCOPY %SSH% %Destination%\SSH /S)
  If Exist %Skype% (ROBOCOPY %Skype% %Destination%\Skype /S)
  If Exist %FileZilla% (ROBOCOPY %FileZilla% %Destination%\FileZilla /S)
  If Exist %Box% (ROBOCOPY %Box% %Destination%\Box /S)
  If Exist %Snagit% (ROBOCOPY %Snagit% %Destination%\Snagit /S)
  If Exist %Cisco% (ROBOCOPY %Cisco% %Destination%\Cisco /S)
  If Exist %StickyNotes% (ROBOCOPY %StickyNotes% %Destination%\StickyNotes /S)
  If Exist %FirefoxPath% (for /F %%I in ('dir "%FirefoxPath%\!FileToFind!" /A-D /B /S 2^&gt;nul') do (
  set "FoundIt=%%~dpI"
  goto FileFound
  )
  :FileFound
  ROBOCOPY %FoundIt% %Destination%\FirefoxBookmarks places.sqlite /S
  )
  ) &gt; "%LogFile%\BackupLog.txt"
  pause
  </code></pre>