Classic Shell
http://classicshell.net/forum/

Enable Hibernate Without Making A Big Useless File
http://classicshell.net/forum/viewtopic.php?f=7&t=5174
Page 1 of 1

Author:  pepanee [ Thu Sep 17, 2015 8:19 am ]
Post subject:  Enable Hibernate Without Making A Big Useless File

Hello, I want to suggest an idea which is really cool and actually would work really nice:
As you know, when you enable Hibernate on your computer, it creates a huge file (C:\hiberfil.sys) just as big as the RAM you have in your computer. But why create and keep that big useless file? It's only good if you Hibernate the computer a lot, but completely useless for it to sit there taking up space.

For example, I have 8GB of RAM. If I enable Hibernate, it will take up 8GB of my hard drive space.

So I want to suggest to have an option to Hibernate in the Start Menu -> Shut Down, but that file (C:\hiberfil.sys) does not exist.
Yet, once you press the Hibernate option to put your computer to Hibernate, then that option would type this in a command prompt:
powercfg.exe -h on

That would enable Hibernate (create a huge file as big as your memory RAM), and put your computer to Hibernate.

Once you turn on the computer, have Classic Start Menu detect that it created that file when you clicked the Hibernate option, and run another command:
powercfg.exe -h off

To turn off Hibernate (and delete that huge useless file that's only good for Hibernate)

Suppose you don't have enough space on the hard drive to create that file, then if someone wants to Hibernate their computer and press that Hibernate option, Classic Start Menu will say that it cannot create a file for Hibernate because of limited disk space or something, and offer to shut down the computer instead. Or even better, if there isn't enough space to create the Hibernate file, then have Classic Start Menu not even show that option at all.

So for example: If I have 117GB of 120GB full in my hard drive, I'll only see the "Sleep", "Restart", "Shut Down", etc.. options but Not "Hibernate".
Yet if I have 40GB of 120GB full in my hard drive, then I will also see "Hibernate" listed in the shut down options.

Don't you think this would be a cool idea?

Consider it please. Thanks!

Author:  Gaurav [ Thu Sep 17, 2015 8:44 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Classic Shell cannot modify the behavior of the Hibernate function in any way, Windows controls it completely. Classic Start Menu can only show it and execute it if it is enabled at the system level.

To save disk space, you can do another optimization instead:
You can reduce the amount of disk space that Windows uses for hibernation by taking advantage of the compression feature. The hibernation file can be a percentage of the total RAM. From an elevated command prompt, type: powercfg /hibernate size 50 or powercfg /hibernate size 65 (that number is the % of total memory). So if your total memory is 8 GB, it won't take all 8GB of disk space but only 50% of it=4 GB.

Author:  pepanee [ Thu Sep 24, 2015 12:59 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Sorry for the late response, but thanks for the reply.

I'll check out what you said about the hibernate feature, but I must've not explained it too well.

What I meant to say was to have that "Hibernate" listed in the shut down list menu, and if I click it, Classic Shell would open some command that will run cmd.exe with the powercfg line. So Classic Shell will tell Windows to run that command, and Windows will try to run it.

If it's not possible, I guess its okay.

Author:  pepanee [ Sat Sep 26, 2015 7:07 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

I tried your suggestion 2 posts before this one. That's a really nice feature that I didn't know about. Thank you for posting that.

I wanted to see if I can minimize that number as much as possible, but apparently 50% (4 GB, for my computer) is the only possible lowest percentage I can set for the Hibernate file. I would've loved to make it go down to 25% (2 GB) or so, but that sets it to 4 GB (which is 50%).

Thank you for the suggestion, and I hope other people who read this find this useful as well.

Author:  pepanee [ Wed Sep 30, 2015 12:53 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Here ya go! I actually figured it all out!!! There's only one little set back about it that I cannot figure out:
• You must press Ctrl+Shift when clicking Hibernate, that's it!
Like I said, if this feature gets implemented into Classic Shell, that would be great. Let me give you the tutorial on how I did this using research and logic:

Thanks to these helpful guides:
1) http://www.instantfundas.com/2008/08/en ... on-on.html
2) http://superuser.com/questions/321151/h ... d-shutdown

Here we go
1) Open Notepad and paste this in there:

powercfg /hibernate on
shutdown /h

2) Save this file as: Enable Hibernate & Hibernate Computer.cmd
(Make sure to get rid of the .txt extension)

3) Open Notepad and paste this in there:

powercfg /hibernate off

4) Save this file as: Disable Hibernate.cmd
(Make sure to get rid of the .txt extension)

5) Put these two files somewhere safe where they won't get deleted
6) Search for and open: taskschd.msc
7) Create Task...
Name: Disable Hibernate
Check: Run with highest privileges
8) Under Triggers, press New
Begin the task: On an event
Log: System
Source: Power-Troubleshooter
Event ID: 1
9) Under Actions, press New, press Browse & select: Disable Hibernate.cmd
10) Save all that
11) Right click your Start button -> Settings -> Check Show all settings -> Customize Start Menu -> Double click Hibernate (on the left side)
12) Command: Browse for and select "Enable Hibernate & Hibernate Computer.cmd"
13) Save all, and that's it! Just make sure to press Ctrl+Shift and click Hibernate. If you only click, nothing will happen.

Summary: When you Hibernate, a hiberfil.sys gets created in C:/ and you computer will Hibernate. Once you start up the computer from Hibernate, that file will get deleted. That's it!

Nice.

Author:  pepanee [ Thu Oct 08, 2015 2:56 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

The whole point of this idea is to avoid keeping the big hiberfil.sys file sitting in your hard drive, so you can have a few more GB of space to use. I am curious, has anyone found my previous post useful at all?

Author:  pepanee [ Sat Dec 05, 2015 4:19 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Is there a way that when I click that "Hibernate" link, I could have Classic Shell automatically press Ctrl+Shift for me with the click of that link? Is there some code that I can put in that link's settings to do that for me?

Thanks.

Author:  Ivo [ Sat Dec 05, 2015 6:19 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

I don't know why Ctrl+Shift affects the behavior of Hibernate, but the start menu can't press keys.
If you find a command that gets the same behavior you can hook it as a custom menu item.

Author:  pepanee [ Sun Dec 06, 2015 10:49 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Hi, I was actually referring to my long post above. I created that "Hibernate" link as a custom link to open a ".cmd" file (Take a look at that post above). Is there any way that I can make an extra custom command in Classic Start Menu that can hold down Ctrl+Shift when I click that certain customized "Hibernate" link?

Author:  Ivo [ Mon Dec 07, 2015 8:02 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Ah, I think I understand. Ctrl+Shift makes it run as admin. You can create a shortcut to the .cmd file and mark it as requiring admin access. Then you don't have to press Ctrl+Shift.

Author:  pepanee [ Mon Dec 07, 2015 12:02 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

You're right, sorry if I didn't mention that Ctrl+Shift makes it run as an admin. Yes that's the whole reason for the Ctrl+Shift. And I've actually tried what you posted; I made a shortcut to the .cmd file and set it to always run as admin, and I made Classic Start Menu settings to run that shortcut to that .cmd file, yet it didn't work for some reason. Did I set it up incorrectly somehow? If you have time, can you please try it all out and see if you can make it work?

Author:  Ivo [ Tue Dec 08, 2015 10:20 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

Hm, a quick test on Windows 7 shows that the "run as admin" setting is grayed out for cmd files. You may have to find a way to create an exe. There are few systems out there to convert scripts into exes. I'm not very familiar with them.

Author:  pepanee [ Tue Dec 08, 2015 11:28 am ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

I have Windows 8.1, and the same thing applies here; the "run as admin" setting is also grayed out. So I actually created a shortcut to that .cmd file, and was able to set the shortcut to run as admin. Yet the odd thing is that I let Classic Start Menu run that shortcut instead, but still didn't work which was rather odd; Can you please try that out real quick and see if the same thing applies on your end?
But thanks for this suggestion of converting the cmd file to an exe. I never thought of that idea, so I'm gonna look around for something that could do that and have that exe run as administrator. Thanks for that suggestion.

Author:  pepanee [ Tue Dec 08, 2015 7:57 pm ]
Post subject:  Re: Enable Hibernate Without Making A Big Useless File

YES! Thank you so much for your suggestion, because I found a program to convert the 'cmd' file to an 'exe' file (http://f2ko.de/en/b2e.php) .
In the 'exe's properties, I set it to run as an administrator! Now I can click on the start button, put the mouse on the arrow next to 'Shut Down...' and press 'Hibernate', and the computer hibernates!


So in summary, if anyone is reading all this:
I was able to make a command that lets you Hibernate your computer without having a huge hidden file located at C:\hiberfil.sys to exist at all when you're using your computer, which saves you a lot of disk space.

Page 1 of 1 All times are UTC - 8 hours [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/