Advertisement
J2897

Create System Restore Point

Jan 3rd, 2015
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.69 KB | None | 0 0
  1. :: Released under the GNU General Public License version 3 by J2897.
  2.  
  3. @echo OFF
  4.  
  5. REM Create a shortcut to this file to quickly create impromptu system restore points.
  6. REM Simply right-click the shortcut and select 'Run as administrator'.
  7. REM This saves you from having to keep messing around and looking for GUIs.
  8.  
  9. pushd "%~dp0"
  10. ver | find "Version 6." > nul
  11. if %ERRORLEVEL%==0 (
  12.     REM Do OPENFILES to check for administrative privileges
  13.     openfiles > nul
  14.     if errorlevel 1 (
  15.         color cf
  16.         echo.
  17.         echo Right-click on this file and select 'Run as administrator'.
  18.         echo.
  19.         pause
  20.         color
  21.         exit /b 1
  22.     )
  23. )
  24.  
  25. REM Create a restore point.
  26. ::schtasks /run /tn "\Microsoft\Windows\SystemRestore\SR"
  27. ::https://social.technet.microsoft.com/Forums/windows/en-US/03bd9fe3-0a87-470f-b0d2-79699009dcf4/windows-7-system-restore-automatic-restore-points-not-created
  28. if not exist CreateSRP.vbs (
  29.     echo Set obj ^= GetObject^( "winmgmts:\\.\root\default:Systemrestore"^) & echo obj.CreateRestorePoint"Impromptu Restore Point",0,100
  30. )>CreateSRP.vbs
  31. echo Creating a restore point ...
  32. start "" CreateSRP.vbs
  33.  
  34. REM Wait for a moment to give Windows enough time to create the restore point.
  35. echo.
  36. echo It's safe to close this window if you don't need to see the restore points.
  37. timeout /t 120
  38.  
  39. REM Show the restore points.
  40. if exist "%PROGRAMFILES%\CCleaner\CCleaner.exe" (
  41.     start "" /D "%PROGRAMFILES%\CCleaner\" "%PROGRAMFILES%\CCleaner\CCleaner.exe" /tools
  42.     msg %USERNAME% /time:600 Take a look at CCleaner's System Restore section.
  43. ) else (
  44.     start "" rstrui.exe
  45.     msg %USERNAME% /time:600 Select 'Choose a different restore point' and click Next. Then tick the box to see all of the restore points.
  46. )
  47.  
  48. popd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement