Specify next boot to be into Safe Mode/WinRE via command line?

As the title says I would like a script that tells Windows that the next boot should be into Safe Mode or at least that the F8 menu should be presented on next boot.

Booting into WinRE (Launch startup repair...) is probably even more un-doable.

I looked over bcdedit options but didn't see anything like this. I know msconfig has an option for Safe Boot but it's GUI only.

Currently if I want to boot into Safe Mode or launch WinRE then I have to forcefully restart my PC first for those options to be presented during boot (F8 does not bring up the Safe Mode option under normal conditions).

I'm using Windows 7 x64.


bcdedit /default <id> is how you force it to boot into a non-default partition. Use bcdedit to list them and select the identifier you want. To force the current OS into safe mode at next startup, bcdedit /set {current} safeboot network.

Remember to undo all of this afterward; it might be safer to follow the directions here and create a new id for the safemode option, so that it's easy to switch back.