WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: snowsnowsnow on April 04, 2024, 08:37:41 PM

Title: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: snowsnowsnow on April 04, 2024, 08:37:41 PM
(I'm back - been off WB for a long time now - but still dabble in it)

This is OT, but I've often asked general Windows questions here in the past and gotten good answers (better than I get from any of the usual online help places).\

Anyway, I'm running Win 7 (this can't be changed) and running out of disk space from time to time (this also cannot be changed).  By accident, I found the "Disk Cleanup" function by searching in the Start Menu.  It works fine, but it is somewhat inconvenient to do it this way (popping up the Start Menu, typing in "Disk Cleanup" in the Search window, hitting enter a couple times, etc).

There is usually a "rundll" or similar trick to running these things directly from the command line or from a script.  Does anyone know of such a trick for Disk Cleanup?  Thanks.

Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: td on April 04, 2024, 10:08:25 PM
There is "cleanmgr" which executes from a cmd prompt. Not sure but I believe it is available on Windows 7.
Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: td on April 04, 2024, 10:30:57 PM
And welcome back.
Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: spl on April 06, 2024, 05:04:04 AM
Quote from: td on April 04, 2024, 10:08:25 PMThere is "cleanmgr" which executes from a cmd prompt. Not sure but I believe it is available on Windows 7.

and if it is, running C:\windows\system32\cleanmgr.exe /? from cmd will show available options. And, to echo Tony... welcome back
Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: snowsnowsnow on April 07, 2024, 03:49:53 PM
Thank you all.

In fact, "cleanmgr" works fine from the command line (in W7).  Thanks for the tip.

(I haven't tried the /? option yet, but that sounds like it could also be useful)
Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: spl on April 08, 2024, 03:19:02 AM
Quote from: snowsnowsnow on April 07, 2024, 03:49:53 PM(I haven't tried the /? option yet, but that sounds like it could also be useful)

Microsoft has some details about the cleanup options here:
https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/automating-disk-cleanup-tool
Title: Re: (off topic) (Win7) How to invoke "Disk Cleanup" from the command line?
Post by: snowsnowsnow on April 08, 2024, 06:46:45 AM
QuoteMicrosoft has some details about the cleanup options here:

Yeah, I'll have to take a look at that.  I tried the /? and got a nice, well-formatted help message that was entirely gibberish.