Guest User

Untitled

a guest
Dec 22nd, 2012
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Echo Off
  2.  
  3. REM Check Windows Version
  4. ver | findstr /i "5.0." > nul
  5. IF %ERRORLEVEL% EQU 0 goto ver_nt5x
  6. ver | findstr /i "5.1." > nul
  7. IF %ERRORLEVEL% EQU 0 goto ver_nt5x
  8. ver | findstr /i "5.2." > nul
  9. IF %ERRORLEVEL% EQU 0 goto ver_nt5x
  10. ver | findstr /i "6.0." > nul
  11. IF %ERRORLEVEL% EQU 0 goto ver_nt6x
  12. ver | findstr /i "6.1." > nul
  13. IF %ERRORLEVEL% EQU 0 goto ver_nt6x
  14. goto warn_and_exit
  15.  
  16. :ver_nt5x
  17. :Run Windows 2000/XP specific commands here
  18. bootcfg /raw /a /safeboot:network /id 1
  19. REG ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v "*UndoSB" /t REG_SZ /d "bootcfg /raw /fastdetect /id 1"
  20. SHUTDOWN -r -f -t 07
  21. goto end
  22.  
  23. :ver_nt6x
  24. :Run Windows Vista/7 specific commands here
  25. bcdedit /set {current} safeboot network
  26. REG ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v "*UndoSB" /t REG_SZ /d "bcdedit /deletevalue {current} safeboot"
  27. SHUTDOWN -r -f -t 07
  28. goto end
  29.  
  30. Echo On
  31.  
  32. :warn_and_exit
  33. echo Machine OS cannot be determined.
  34.  
  35. :end
  36.  
  37. Dim oShell, returnCode
  38. Set objShell = CreateObject("Shell.Application")
  39. Set oShell = WScript.CreateObject("WScript.Shell")
  40.  
  41. returnCode = oShell.Popup("Do you want to restart your computer in Safe Mode", 0, "Restart In Safe Mode", 4 + 48 + 256)
  42.  
  43. Select Case returnCode
  44. case 6, -1
  45. objShell.ShellExecute "tryout.bat", "", "", "runas", 0
  46. case 7
  47. oShell.popup "Operation Canceled", 0, "Restart In Safe Mode", 0 + 64 + 0
  48. End Select
Add Comment
Please, Sign In to add comment