Jesus 'n Jim
A mainly PC (some Mac) site w/Software, Computer Repair Info, How-To's on Using Computers
Technical Support 1-360-521-2060 (my business line cell)

hibernate,shutdown,logoff,standby batch files

 

MinGW compiled executables with sources [windows 32+64-bit]).

Hibernate is a collection of batch files and 32+64-bit executeables that can use GRC's wizmo (or my acpi.exe), that will put a machine into hibernation, standby, shut it down, exit windows, logoff, and the like. this is useful if you are going to bed and you have a long batch job running and you want the computer to shut itself down after it is done (the keyboard buffer/queue for cmd.exe is large enough, or you can use a batch file).

the executables do not currrently work properly on a hosed OS. I had trouble getting the program to work right.

batch files are available as hibernate.zip. It is under the GPL3 license. lsm file.

Download Now
hibernate.zip (version 1.5, Sep 26, 2010)


09/26/2010  02:10 PM           166,038 hibernate.zip

SHA512 hibernate.zip
d9ea00affa562e3e a5b63ca488c7e46d a49b7dba8b8d01b6 df7a696343c72e7e
af639063cbbef6aa c22cb26558ad9a1d 70bb440ab6645a05 e3c7fbd8b195f070

MD5 hibernate.zip
ec2c1c47f26378ef527735a99b3a763d

you really don't have to use my hibernate program (though mine is easier to use than windows' shutdown.exe program). here is the basics of windows' shutdown program:
reboot, shutdown -r
forced reboot, shutdown -f -r
shutdown, shutdown -s
forced shutdown, shutdown -f -s
abort shutdown or reboot, shutdown -a

These are batch files and a .exe (or you can use GRC's wizmo) that can shut down, reboot, hibernate, standby and exit from windows. one command for each. The program does the actual shutting down and it does all these operations via arguments. The batch files make things simpler to use. because the contents of the wizmo page are copyrighted, I don't think I have permission to distribute the program with this zip file. but I included an internet shortcut to the page which happens to be http://www.grc.com/wizmo/wizmo.htm

exitwindows.bat  (note: the exit command is already taken!)
exitwin.bat
hibernate.bat  (I like shortening it to hib.bat)
hib.bat
logoff.bat
logout.bat
reboot.bat
restart.bat
shutdown.bat
shut.bat
standby.bat

A shutdown.exe already exists within c:\windows\system32, so you are going to have to find a way to insert the directory that contains the batch files and the .exe in the PATH ahead of %SystemRoot%\system32

The batch files and the program should be in your PATH. You will need to copy the acpi.exe and the batch files from acpi-version OR acpi64.exe and the batch files from acpi64-version OR wizmo.exe and the batch files from wizmo-version into a directory/folder that is in your PATH, or make one and put that directory in your PATH.

acpi.exe and acpi64.exe both will not execute by themselves without a command.

.cmd files work on windows NT/2000/2003/2008/xp/vista/7
.bat files work on 98/me and maybe 3.1 (also work with later vbersions of windows, but not sure about 64-bit versions of windows - I think it works there too)
I suspect that the acpi.exe will only work with NT or better.

C:\prj\hibernate-1.1\win>acpi
acpi - shutdown windows via the various methods (logoff, shutdown, etc.)
usage: acpi [[-]-?] [[-]-h[elp]] [[-]-v[er[sion]]]
       acpi [logoff/logout] [exit] [reboot/restart] [shutdown] [standby/suspend]
 [hib[ernate]] [stop]

-? or -h or -help or no arguments gives this help and exits.
-v or -ver or -version gives the verion information and exits.
acpi logoff or acpi logout logs you out of the system.
acpi exit does an exit out of windows and tells you that you can now turn off th
e computer.
acpi reboot or acpi restart causes the system to restart.
acpi shutdown causes the system to shutdown.
acpi standby or acpi suspend causes the system to go into standby mode.
acpi hibernate causes the system to hibernate.
acpi stop causes a shutdown to stop.
Note that any shutdown may not always be successful.
Copyright 1996 Prentice-Hall, Copyright 2009 Jim Michaels. U
nder GPL3 License.

C:\prj\hibernate-1.1\win>

It is very unlikely you will be able to run ANYTHING once any kind of shutdown has been started, since the OS disables starting of new programs.

boilerplate

The GNU compiler set has the peculiar ability to glob filenames at the command line. this can be a nice or an unwanted feature. to get around it, aurround the * with double quotes "*". This includes DJGPP-generated and MinGW-generated code.

The windows version was also compiled with MinGW 5.1.4 which is a GNU compiler set for windows. it has the peculiarity that it requires any use of __int64 to #include <basestd.h>, and it also doesn't allow 64-bit constants in the microsoft/borland style of appending i64 to the number. it requires you to use the gcc LL instead, however, printf does use %I64d rather than the normal gcc %lld. If you use %lld, your program will crash and do the DrWatson error report thing.


Copyright 2008,2009 Jim Michaels

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.