Problem : Can robocopy be made to run in the background?
I currently have a batch file setup to run backups using robocopy. It works great but I don’t like having the CMD window open while the backup is running. Is there any way to make this run in the background so this window does not have to be open?
Solution: Can robocopy be made to run in the background?
To do this you will need to run a vbscript to run the robocopy bat file. Copy and paste the code below into notepad. Change the path (where indicated) to the location of your robocopy bat file. Now save the file as “filename.vbs”. The *.vbs file will run when u double click on it or run it from scheduler….u will not see any window pop-up. To verify your robocopy is running….launch taskmanager.
‘Replace the path below with the location of your robocopy batch file
sBatFile = “c:\Program Files\Scripts\mybackup.bat”
Set oShell = CreateObject(“WScript.Shell”)
Set oFSO = CreateObject(“Scripting.FileSystemObject”)
If Not oFSO.FileExists(sBatFile) Then
MsgBox “Could not find batch file, make sure the path is correct. Closing Script!”, _
vbCritical + vbSystemModal, “Text search”
sBatFileShort = oFSO.GetFile(sBatFile).ShortPath
oShell.Run sBatFileShort, 0, True
Set oShell = nothing
Set oFSO = nothing