How do I make a hibernation batch file?

ryanscottmurphy picture ryanscottmurphy · Nov 2, 2011 · Viewed 18.4k times · Source

I'm trying to make a batch file that executes a simple command:

shutdown -h

I've created a shutdown.bat file with that exact line in it, yet when I run it, all it does is spam the command prompt like crazy.

I've looked at batch file sites, @echo off seems popular, but doesn't that just hide output while the commands are executed just the same?

Answer

ryanscottmurphy picture ryanscottmurphy · Nov 5, 2011

It turns out that adding a change directory command to the root of the drive fixes the problem. The final text that I ended up using in the .bat file was:

cd c:\
shutdown /h