title: Run a process RunOnce in safe mode?
body: <p>I need to run a process one time after a reboot in safe mode, the process is this:</p>
  
  <pre><code>bcdedit.exe /import "%WINDIR%\Restore BootLoader Settings.bcd"
  </code></pre>
  
  <p>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?</p>
  
  <p>To be more explicit this is what I'm trying to do:</p>
  
  <ol>
  <li><p>In normal mode or whatever else mode I export the current settings of all the Boot Loader entries.</p></li>
  <li><p>Then I change some parametters of the current boot loader entry and then I reset the PC.</p></li>
  <li><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.</p></li>
  </ol>
  
  <p>How can I do that?</p>
  
  <p>This is my vbs script:</p>
  
  <pre><code>' 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 = """" &amp; wshShell.ExpandEnvironmentStrings("%WINDIR%") &amp; "\" &amp; "Bcdedit settings.bcd" &amp; """"
  
  wshShell.Run "bcdedit /export " &amp; 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 " &amp; TempFile, _
  "REG_SZ"
  
  wshShell.Run "shutdown -r -t 00 -f", 0, True
  </code></pre>
  
  <p>End If</p>