It’s very easy to do it on Unix/Linux, cron is a very powerful tool for it.
But how to do it on Windows?
Run->”gpedit.msc”->”Computer ConfigurationWindows Settings” for Startup/Shutdown or “User ConfigurationWindows Settings” for Logon/Logoff.
Reference:
How to: Add startup and shutdown scripts in Windows – Online Training and Tutorials
Specify a Script to Run on Startup Shutdown Logon Logoff