;================================================== ;RoboBackup&Restore.au3 ;compile with AutoIt ;================================================== $g_szVersion = "RoboBackup&Restore 1.0" If WinExists($g_szVersion) Then Exit AutoItWinSetTitle($g_szVersion) AutoItSetOption("RunErrorsFatal", 0) AutoItSetOption("ExpandEnvStrings", 1) AutoItSetOption("TrayIconHide", 1) Dim $var1, $file ;================================================== If Not FileExists(@SystemDir & '\robocopy.exe') Then FileInstall('Robocopy.exe', @SystemDir & '\Robocopy.exe', 0) #include While 1 $var1 = InputBox("SelectBackupLocation", "Enter the Location.", "", " M60", 40, 20) If @error = 1 Then MsgBox(0, "User Cancelled", "User cancelled, Exiting Program", 3) Exit EndIf FileClose($file) FileDelete($file) ExitLoop WEnd GUICreate("RoboBakup&Restore", 281, 169, (@DesktopWidth - 281) / 2, (@DesktopHeight - 169) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $font = "Arial Bold" GUISetFont(12, 600, "", $font) $Button_1 = GUICtrlCreateButton("Backup", 30, 60, 90, 40) $Button_2 = GUICtrlCreateButton("Restore", 160, 60, 90, 40) $Button_3 = GUICtrlCreateButton("Quit", 90, 120, 100, 30) $Label_4 = GUICtrlCreateLabel("RoboCopy Backup and Restore", 18, 8, 290, 28) $Label_5 = GUICtrlCreateLabel("___________________________", 18, 26, 290, 28) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Button_1 RunWait('robocopy "' & @UserProfileDir & '\Desktop"' & ' "' & $var1 & "\" & @UserName & '\Desktop" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Citrix"' & ' "' & $var1 & "\" & @UserName & '\Citrix" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Contacts"' & ' "' & $var1 & "\" & @UserName & '\Contacts" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Documents"' & ' "' & $var1 & "\" & @UserName & '\Documents" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\3D Objects"' & ' "' & $var1 & "\" & @UserName & '\3D Objects" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Downloads"' & ' "' & $var1 & "\" & @UserName & '\Downloads" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Favorites"' & ' "' & $var1 & "\" & @UserName & '\Favorites" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Links"' & ' "' & $var1 & "\" & @UserName & '\Links" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Music"' & ' "' & $var1 & "\" & @UserName & '\Music" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\OneDrive"' & ' "' & $var1 & "\" & @UserName & '\OneDrive" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Pictures"' & ' "' & $var1 & "\" & @UserName & '\Pictures" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Saved Games"' & ' "' & $var1 & "\" & @UserName & '\Saved Games" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Searches"' & ' "' & $var1 & "\" & @UserName & '\Searches" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Videos"' & ' "' & $var1 & "\" & @UserName & '\Videos" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\My Documents"' & ' "' & $var1 & "\" & @UserName & '\My Documents" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & @UserProfileDir & '\Local Settings\Application Data"' & ' "' & $var1 & "\" & @UserName & '\Local Settings\Application Data" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) MsgBox(0, "Job Status", "Backup Done ...", 2) FileDelete($file) Case $msg = $Button_2 RunWait('robocopy "' & $var1 & "\" & @UserName & '\Desktop"' & ' "' & @UserProfileDir & '\Desktop" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Citrix"' & ' "' & @UserProfileDir & '\Citrix" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Contacts"' & ' "' & @UserProfileDir & '\Contacts" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Documents"' & ' "' & @UserProfileDir & '\Documents" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\3D Objects"' & ' "' & @UserProfileDir & '\3D Objects" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Downloads"' & ' "' & @UserProfileDir & '\Downloads" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Links"' & ' "' & @UserProfileDir & '\Links" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Music"' & ' "' & @UserProfileDir & '\Music" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\OneDrive"' & ' "' & @UserProfileDir & '\OneDrive" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Pictures"' & ' "' & @UserProfileDir & '\Pictures" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Saved Games"' & ' "' & @UserProfileDir & '\Saved Games" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Searches"' & ' "' & @UserProfileDir & '\Searches" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Videos"' & ' "' & @UserProfileDir & '\Videos" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Favorites"' & ' "' & @UserProfileDir & '\Favorites" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\My Documents"' & ' "' & @UserProfileDir & '\My Documents" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) RunWait('robocopy "' & $var1 & "\" & @UserName & '\Local Settings\Application Data"' & ' "' & @UserProfileDir & '\Local Settings\Application Data" /S /E /R:0 /W:0', "", @SW_SHOWNORMAL) MsgBox(0, "Job Status", "Restore Done ...", 2) FileDelete($file) Case $msg = $Button_3 Exit Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit ;==================================================