Hibernation is a wonderful feature. Not only does it allow you to power-off your computer with all programs running and unsaved, it actually speeds up the process of switching ON and OFF your computer. However, one downside of hibernation is that Windows creates a hibernation file (HIBERFIL.SYS) on your C drive which is exactly equal to the size of the physical memory or RAM on your system. If you have 2GB of RAM, the hibernation file on your hard disk will be of 2GB. This 2GB is huge if you are low on disk space. The other downside of hibernation is that this HIBERFIL.SYS file is stuck on the C drive and there is no way of moving it to another partition or hard drive.
So the space occupied by that HIBERFIL.SYS is space wasted, a sort of, since you only require it at the time of hibernation.
To deal with this problem we will create a batch file, two actually, that will enable Windows hibernation only when you need to hibernate and then disable the hibernation file once you resume from hibernation.
Open Notepad and copy paste the following lines into it and save it with an extension CMD, like hibernate.CMD
powercfg /hibernate on
rundll32.exe PowrProf.dll, SetSuspendState
The first command will enable Windows hibernation. The second command will hibernate your computer. This CMD file will be your shortcut to hibernate your computer.
Now, we need to disable hibernation after the computer resumes from hibernation. Open Notepad again, copy paste the following line and save it with the CMD extension too, but with a different name, say disable_hibernation.CMD.
powercfg /hibernate off
This command will disable Windows hibernation. In order to run this file automatically after the computer resumes from hibernation, we will use a small tool called Hibernate Trigger. This program allows you to automatically launch application after the computer resumes from standby or hibernation. Now you just have to configure this program to run the second CMD file you created on resume.
Every time you want to hibernate, use the first CMD file you created to enable hibernation and then hibernate the computer. When you resume from hibernate, Hibernate Trigger will run the "powercfg /hibernate off" file and disable hibernation. Thanks Jim for the tip.