Существует ли способ перезагрузить компьютер в безопасный режим с помощью CMD/BAT/VBS/скрипта? Что-то типа
Код:
Код: Выделить всё
shutdown -r -s -t 00, где "-s" — "Safe Mode" (это лишь пример, как это могло бы выглядеть)
Код: Выделить всё
shutdown -r -s -t 00Код: Выделить всё
:ver_nt5x
:Run Windows 2000/XP specific commands here
bootcfg /raw /a /safeboot:network /id 1
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v "*UndoSB" /t REG_SZ /d "bootcfg /raw /fastdetect /id 1"
SHUTDOWN -r -f -t 05
goto endКод: Выделить всё
:ver_nt5x
:Run Windows 2000/XP specific commands here
bootcfg /raw /a /safeboot:network /id 1
REG ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v "*UndoSB" /t REG_SZ /d "bootcfg /raw /fastdetect /id 1"
SHUTDOWN -r -f -t 05
goto endКод: Выделить всё
Echo Off
REM Check Windows Version
ver | findstr /i "5\.0\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt5x
ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt5x
ver | findstr /i "5\.2\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt5x
ver | findstr /i "6\.0\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt6x
ver | findstr /i "6\.1\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt6x
ver | findstr /i "6\.2\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt6x
ver | findstr /i "6\.3\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt6x
ver | findstr /i "10\.0\." > nul
IF %ERRORLEVEL% EQU 0 goto ver_nt10x
goto warn_and_exit
:ver_nt5x
:Run Windows 2000/XP specific commands here
bootcfg /raw /a /safeboot:network /id 1
REG ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v "*UndoSB" /t REG_SZ /d "bootcfg /raw /fastdetect /id 1"
SHUTDOWN -r -f -t 03
goto end
:ver_nt6x
:Run Windows Vista/7/8/8.1 specific commands here
bcdedit /set {current} safeboot network
REG ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v "*UndoSB" /t REG_SZ /d "bcdedit /deletevalue {current} safeboot"
SHUTDOWN -r -f -t 03
goto end
:ver_nt10x
:Run Windows 10 specific commands here
bcdedit /set {current} safeboot network
REG ADD HKLMSOFTWAREMicrosoftWindowsCurrentVersionRunOnce /v "*UndoSB" /t REG_SZ /d "bcdedit /deletevalue {current} safeboot"
SHUTDOWN -r -f -t 03
goto end
Echo On
:warn_and_exit
echo Machine OS cannot be determined.
:end
Код: Выделить всё
Dim oShell, returnCode
Set objShell = CreateObject("Shell.Application")
Set oShell = WScript.CreateObject("WScript.Shell")
returnCode = oShell.Popup("Do you want to restart your computer in Safe Mode", 0, "Restart In Safe Mode", 4 + 48 + 256)
Select Case returnCode
case 6, -1
objShell.ShellExecute "REBOOT.bat", "", "", "runas", 0
case 7
oShell.popup "Operation Canceled", 0, "Restart In Safe Mode", 0 + 64 + 0
End Select
Код: Выделить всё
objShell.ShellExecute "REBOOT.bat", "", "", "runas", 0
Код: Выделить всё
objShell.ShellExecute "D:\REBOOT.bat", "", "", "runas", 0