【问题标题】:Run a process RunOnce in safe mode?在安全模式下运行进程 RunOnce?
【发布时间】:2013-09-19 19:15:44
【问题描述】:

我需要在安全模式下重启后运行一次进程,进程是这样​​的:

bcdedit.exe /import "%WINDIR%\Restore BootLoader Settings.bcd"

我尝试使用 RunOnce 密钥,但我注意到密钥在安全模式启动下不会运行,所以...是否存在任何其他方式来在安全模式启动下运行该死的进程?

更明确地说,这是我想要做的:

  1. 在正常模式或其他任何模式下,我都会导出所有引导加载程序条目的当前设置。

  2. 然后我更改当前引导加载程序条目的一些参数,然后重置 PC。

  3. 1234563 /p>

我该怎么做?

这是我的 vbs 脚本:

' Restart in Safe Mode
' By Elektro H@cker

If Not Msgbox( _
    "¿Seguro que quieres reiniciar el equipo?", _
    4 or 48, _
    "Reiniciar en Modo Seguro..." _
    ) = vbNo _
Then

Set wshShell = WScript.CreateObject("WScript.Shell")

TempFile = """" & wshShell.ExpandEnvironmentStrings("%WINDIR%") & "\" & "Bcdedit settings.bcd" & """"

wshShell.Run "bcdedit /export " & TempFile, 0, True
wshShell.Run "bcdedit /set {current} safeboot minimal", 0, True

wshShell.RegWrite _
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\Restore BootLoader Settings",  _
"bcdedit.exe /import " & TempFile, _
"REG_SZ"

wshShell.Run "shutdown -r -t 00 -f", 0, True

如果结束

【问题讨论】:

    标签: windows vbscript console runonce bcdedit


    【解决方案1】:

    我刚刚在这里学到了一些新东西:

    根据:http://msdn.microsoft.com/en-us/library/aa376977%28v=vs.85%29.aspx

    默认情况下,这些键在计算机启动时会被忽略 安全模式。 RunOnce 键的值名称可以带有前缀 星号 (*) 强制程序在安全模式下运行。

    【讨论】:

    • 非常有用,救了我的命!!唯一不方便的是 Windows 资源管理器在运行的应用程序终止执行之前不会加载:-/ Ps:对不起我的英语
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多