Archive for the ‘ DOS ’ Category

Disable hiberfile.sys

hiberfile.sys is a huge file normally found in your Windows root directory. Normally it’s a file 75% size of your total amount of RAM. So if you have 32GB installed, you’ll have a 24GB hiberfile.sys file sitting there taking up space for no reason.

If you can live without the hibernation feature (this is more the case for desktops – hibernation is actually quite useful for laptops) then you can disable the feature and remove the file with this simple DOS command:

powercfg.exe -h off

Just remember to launch theĀ  command prompt and “Run As Administrator”.


More info here:
https://www.cnet.com/how-to/how-to-enable-or-disable-hibernate-in-windows-10/

Batch rename file extensions in Windows

This is a handy trick I found when I needed to batch rename a hundred .THM files to .JPG.
Open DOS and run the following command:

ren *.XXX *.YYY

Where XXX is the source and YYY is the target extension.
That’s it!

Remote Windows shutdown

To remote shutdown a workstation in 5mins from now:

shutdown /s /t 300 /m \\EWEAW00020

To cancel the command:

shutdown /a /m \\EWEAW00020

 

Deleting the winsxs folder

In C:\Windows there is a system folder called “winsxs” which stores all the installation files used to update and upgrade Windows.

This folder, on my Windows 7 64-bit system, took up 12GB of space on my precious 80GB SSD drive.

Launch the DOS prompt with administrator rights and run the following command to remove all the files.

Dism.exe /online /Cleanup-Image /SPSuperseded

Moving the MSOCache files

When you install Microsoft Office, by default it will leave a folder of installation files on the C: drive. You cannot delete this folder because every time MS Office needs to update itself, it uses those files.

With the MS Office 2013 edition, I have a folder with 830MB of files! On a small SSD, this is precious space that needs recovering. So what to do?

One trick I came across today is to move those files to another disk and create a symbolic link to them:

mklink /D "C:\MSOCache" "D:\MSOCache"

And that’s it!

 

Creating symbolic links in Windows

I learned today, it’s possible to create a symbolic link in Windows! Here’s what you need to do:

  1. Run the DOS prompt as Administrator.
  2. Use the following command as an example:

    mklink /D "C:\MSOCache" "D:\MSOCache"

  3. Without the “/D” it’ll be a symbolic link for a file. To link a directory and all its files, use the “/D” option.
    The first variable will be the actual symbolic link.
    The second variable is where the files will actually reside.