Execute Something / Open Folder / Do Something after Reboot – Windows RunOnce

So… many times I have issue with services not closing out or locked files and other nitty gritty’s with Windows.
Here are a few simple solutions on working with Windows RunOnce

So for you who might be reading this and saying but wait can’t I just add this to the startup? yes you can but if you add it to startup you will need to clean up after yourself and startup will run after everything else has been started….

RunOnce is defined in the Windows Registry, under the following Key


[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]

You now can create new String Values
If you want to run something or Any Application


"SomeStringName"="c:\\Yeshai\YeshaiTest.vbs"

Or to open a folder for a user


"SomeStringName"="C:\\Windows\"

In essence you can simply split your scripts to Phase1.vbs and Phase2.vbs if you require a reboot in between or update a registry/temp file before the reboot and continue after

Just my two cents about this.. some more generic info from MS can be found here – Linky

This entry was posted in Batch Files, Scripting and tagged , , , , , , . Bookmark the permalink.