Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Disk Cleanup : Extended

02 Mar 2017   #80
ThrashZone

Win-7-Pro64bit 7-H-Prem-64bit
 
 

Hi,
Yep I don't use this anymore no need disk space is cheap now days
If someone really needs the little space it might find it is past time to get a larger ssd or hdd


My System SpecsSystem Spec
.
02 Jun 2017   #81
Space Cowboy

Windows 7 64 Bit
 
 
Auto Run In Task Scheduler

Hi Everyone,

If I setup a task to run the VBS file at a certain time, every day, How can I make the task hit ok and just run it minimized?

I'm guessing I need to add a few extra commands?

Thank You !!
My System SpecsSystem Spec
18 Mar 2018   #82
Paul Black

Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Good evening,

I know this is an old thread now but I have a question please about Windows 7: Disk Cleanup : Extended.

Excellent by the way Bare Foot Kid .

I want to include this and run it in a batch file at the end of other stuff that is done (I have condensed the code below to just include the Disk Cleanup : Extended portion).

It does actually work fine but I have to press "OK" for it to continue or "Cancel" to not.

How can I adapt the script below so it automatically presses the "OK" for me in the script please?

I don't want the popup box to appear I just want it to do it.

I have tried /Q at the end, I have also tried Click [OK] but to no avail.

I have also tried all of the following: (with the cd C:\windows\system32 first obviously)

C:\Windows\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
Shell ("%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535")
Shell C:\Windows\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
Shell "C:\Windows\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535"
Shell ("C:\Windows\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535")

Unfortunately on the occasions when Shell is included it gives me an error saying:
'Shell' is not recognised as an internal or external command, operable program or batch file.

Anyway, here is the batch file script I have:

Code:
echo off
echo.
echo [12] Running extended cleanup...
cd C:\windows\system32 
%SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
echo. & echo This process completed successfully. & echo. & pause & cls
exit
Any help will be greatly appreciated.

Thanks in advance.
My System SpecsSystem Spec
18 Mar 2018   #83
Brink

64-bit Windows 10 Pro
 
 

Hello Paul, :)

If you like, you could use the same command below from Option Two below. The command needs to "Run as administrator" (elevated).

cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535

Open and Use Disk Cleanup in Windows 10 Windows 10 Tutorials
My System SpecsSystem Spec
.

18 Mar 2018   #84
Paul Black

Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Thanks for the reply Brink, it is appreciated.

Unfortunately this still requires me to click the OK button to continue, which is what I want to bypass!
I just want it to run without me having to do this.

Everything else runs without problems. I am using DISM commands etc before hand and I just want to tidy up after the batch file has completed (that is why I want to execute this as the last thing in the batch file).

As you will see from my code, it will allow it to run to completion (so there are no interuptions to it running) before anything can be done, i.e. Pause = Press any key to continue.

Thanks in advance.
My System SpecsSystem Spec
18 Mar 2018   #85
Brink

64-bit Windows 10 Pro
 
 

You could use the method below to create an elevated shortcut of it to run elevated without getting a UAC prompt.

Elevated Program Shortcut without UAC Prompt - Create - Windows 7 Help Forums
My System SpecsSystem Spec
18 Mar 2018   #86
Paul Black

Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Thanks again Brink for the reply.

I don't have the UAC enabled so that is not a problem.
I need to run it from WITHIN my batch script that I posted and for it to ignore the popup asking me to click OK or Cancel.

Thanks in advance.
My System SpecsSystem Spec
18 Mar 2018   #87
Brink

64-bit Windows 10 Pro
 
 

Ah, you want it to run silently.

I'm not aware of a way to do so.
My System SpecsSystem Spec
18 Mar 2018   #88
Paul Black

Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

OK, thanks anyway Brink for your time and help with this, it is very much appreciated .
My System SpecsSystem Spec
18 Mar 2018   #89
Paul Black

Windows 7 Home Premium 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

I think I have worked out how to do it, sort of (well I don't have to click OK or Cancel)!

Code:
echo off
echo.
echo [12] Running extended cleanup...
cd C:\windows\system32 
Start %SystemRoot%\System32\Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
echo. & echo This process completed successfully. & echo. & pause & cls
exit
This also seems to work:

Code:
echo off
echo.
echo [12] Running extended cleanup...
cd C:\windows\system32 
Start Cmd.exe /c Cleanmgr /sageset:65535 & Cleanmgr /sagerun:65535
echo. & echo This process completed successfully. & echo. & pause & cls
exit
If anyone knows if this is WRONG then please let me know.

The only problem appears to be is at the end of the cleanup process that there is an extra (so I have 2) disk cleanup box that appears (but goes off in about 3 seconds).
The first box says "Scanning: whatever" for example and the second box says "Cleaning: whatever".

Any ideas please?

Thanks in advance.

EDIT:

I have worked it out!

The clicking of the OK button obviously invokes the program to start, hence using Start at the beginning of the command.

The second box only appears because I moved the first box to another location on the screen.

I ran the command from the desktop shortcut that I had created a long time ago (and NOT from inside the batch file itself) leaving the normal position of the box in the middle of the screen and I didn't get a second box appear.

I then ran the command again from the desktop shortcut that I had created a long time ago (and NOT from inside the batch file itself) but this time moving the normal position of the box in the middle of the screen and I DID get a second box appear.

This means that there are 2 boxes generated when the command is run, the 1st box saying Scanning: whatever and the 2nd box saying Cleaning: whatever. The 2nd box is exactly mirrored on top of the 1st box.

I then tested BOTH these scenarios above by running it from WITHIN the Batch file and got EXACTLY the SAME results.

I hope this will help anyone trying to do this in the future.

Brink,

Out of the two code options I posted above, is there one that is better to use than the other one please?
My System SpecsSystem Spec
Reply

 Disk Cleanup : Extended




Thread Tools




Similar help and support threads
Thread Forum
FYI: Extended Disc Cleanup has started killing recent Windows Updates
I've been using the new extended disk cleanup for over a year now with no problems. Occasionally it will find Windows Updates that have been superseded, and remove them. Yay!! BUT, upon using Disk Cleanup yesterday, it removed 4 RECENT, REQUIRED updates that had to be re-installed. It...
Windows Updates & Activation
Disk Cleanup
I understand what defragment does but Iím not clear about disk cleanup. Can someone please explain? And also, please advise me if this is not the most appropriate discussion for this post.
Performance & Maintenance
Disk Cleanup
Which files can safely be checked for Disk Cleanup? I don't want to delete something that may casue an issue with the system working correctly.
Performance & Maintenance
disk cleanup?
can i check everything when i run Disk Cleanup?
Performance & Maintenance
Extended Disk Cleanup : New Tutorial!
I hope everyone finds it useful. :) https://www.sevenforums.com/tutorials/76383-disk-cleanup-extended.html#post668379
Chillout Room


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd

All times are GMT -5. The time now is 07:17.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App