在安全模式下运行进程RunOnce? [英] Run a process RunOnce in safe mode?

查看:67
本文介绍了在安全模式下运行进程RunOnce?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I need to run a process one time after a reboot in safe mode, the process is this:

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

我尝试使用RunOnce密钥,但是我注意到这些密钥不会在安全模式启动下运行,所以...还有其他方法可以在安全模式启动下运行该死的进程吗?

I've tried to use the RunOnce key but I've noticed that keys will not run under a Safe Mode boot so... exists any other way to run the damn process in a safe mode boot?

更明确地说,这就是我要做的事情:

To be more explicit this is what I'm trying to do:

  1. 在普通模式或其他任何模式下,我都会导出所有Boot Loader条目的当前设置.

  1. In normal mode or whatever else mode I export the current settings of all the Boot Loader entries.

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

Then I change some parametters of the current boot loader entry and then I reset the PC.

这是问题所在,例如,当在Windows中以安全模式再次登录时,例如,我需要还原(导入)设置,然后再进行新更改,以使重置机器时仍无法以安全模式启动./p>

Here is the problem, when logged again in Windows in safe mode for example I need to restore (import) the settings before my new changes to don't still booting ever in safe mode when resetting the machine.

我该怎么做?

这是我的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

如果结束

推荐答案

我刚刚在这里学到了一些新知识:

I just learnt something new here:

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

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

By default, these keys are ignored when the computer is started in Safe Mode. The value name of RunOnce keys can be prefixed with an asterisk (*) to force the program to run even in Safe mode.

这篇关于在安全模式下运行进程RunOnce?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆