How to create a hibernation batch file?

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

shutdown -h

I created a .bat file with this exact line, but when I run it, all it does is command line spam, like crazy.

I looked at batch file sites, @echo off seems to be popular, but won't it just show me while it does the same?

+4
source share
3 answers

It turns out that adding the change catalog command to the root of the disk fixes the problem. The final text I used in the .bat file was:

cd c:\ shutdown /h 
+7
source

I think I'm very late for this, but in case anyone else comes across this. The question was really with the bat file name. You called shutdown -h, and the bat file was called shutdown.bat, so the bat file called the calling command prompt loop itself. To fix this, you either rename the bat file or specify the directory where the stop is located.

+1
source

I would like to say that I understood this, but I was just looking for it. The code you need is

 %windir%System32rundll32.exe powrprof.dll,SetSuspendState 

If you run start → run and then enter it, it should work. Therefore, if you included hibernate in poweroptions, this should also work in a batch file.

Hope this helped you

Edit: Postscript, click the white little V under the arrows (to the left of this answer) to accept the answer;)

0
source

Source: https://habr.com/ru/post/1379266/


All Articles