4

Windows Cleaning Tool

 1 year ago
source link: https://forum.xda-developers.com/t/windows-cleaning-tool.4585845/#post-88541235
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Development Windows Cleaning Tool

persona78

Senior Member
Apr 12, 2013 2,532 1,303
Hi!
I build this tool to clean Windows unnecessary files and release storage.

I hope this helps you to.

Github: Windows Cleaning Tool
osha-policies-regulations-sign-onep-35410_1000.png

persona78

Senior Member
Apr 12, 2013 2,532 1,303
Simply a launcher for

View attachment 5911003

isn't it?
No. Do more than that..
Check batch file.

.
In batch file you run
Code:
cleanmgr /AUTOCLEAN
what removes files from the previous Windows installation or the previous in-place upgrade automatically, IIRC.

Why not additionally run
Code:
cleanmgr /VERYLOWDISK >nul
what will cleanup all ( from the system's point of view ) unneeded files automatically
low-disk-UI.png
Last edited: Today at 6:25 AM

persona78

Senior Member
Apr 12, 2013 2,532 1,303
Hi!

cleanmgr.exe /VERYLOWDISK
This switch is used when Windows notifies the user that he is running out of disk space on a drive. It will cleanup all files automatically. It won't show you a confirmation, but will show you a dialog to indicate how much free disk space you have now.

Cleanmgr.exe /AUTOCLEAN
The setup switch analyzes the system files left from a previous Windows version., but the application will remove files from the previous Windows installation or the previous in-place upgrade automatically.

The following folders will be removed:

C:\$Windows.~BT\*
C:\$Windows.~LS\*
C:\$Windows.~WS\*
C:\ESD\Download\*
C:\ESD\Windows\*
C:\$WINDOWS.~Q\*
C:\$INPLACE.~TR\*
C:\Windows.old\*
C:\Windows\Panther

No user interface will be shown.

And my batch will proced next with this powershell code that will enforce the cleanning on all drives:
Code:
$SageSet = "StateFlags0099"
$Base = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\"
$Locations= @(
    "Active Setup Temp Folders"
    "BranchCache"
    "Content Indexer Cleaner"
    "Diagnostic Data Viewer database files"
    "Downloaded Program Files"
    "DownloadsFolder"
    "GameNewsFiles"
    "GameStatisticsFiles"
    "GameUpdateFiles"
    "Feedback Hub Archive log files"
    "Internet Cache Files"
    "Memory Dump Files"
    "Language Pack"
    "Offline Pages Files"
    "Old ChkDsk Files"
    "D3D Shader Cache"
    "Delivery Optimization Files"
    "Previous Installations"
    "Recycle Bin"
    "Service Pack Cleanup"
    "RetailDemo Offline Content"
    "Setup Log Files"
    "System error memory dump files"
    "System error minidump files"
    "Temporary Files"
    "Temporary Setup Files"
    "Temporary Sync Files"
    "Thumbnail Cache"
    "Update Cleanup"
    "Upgrade Discarded Files"
    "User file versions"
    "Windows Defender"
    "Windows Error Reporting Archive Files"
    "Windows Error Reporting Queue Files"
    "Windows Error Reporting System Archive Files"
    "Windows Error Reporting System Queue Files"
    "Windows ESD installation files"
    "Windows Upgrade Log Files"
    "Windows Reset Log Files"
)

# -ea silentlycontinue will supress error messages
ForEach($Location in $Locations) {
    Set-ItemProperty -Path $($Base+$Location) -Name $SageSet -Type DWORD -Value 2 -ea silentlycontinue | Out-Null
}

# Do the clean-up. Have to convert the SageSet number
$Args = "/sagerun:$([string]([int]$SageSet.Substring($SageSet.Length-4)))"
Start-Process -Wait "$env:SystemRoot\System32\cleanmgr.exe" -ArgumentList $Args

# Remove the Stateflags
ForEach($Location in $Locations)
{
    Remove-ItemProperty -Path $($Base+$Location) -Name $SageSet -Force -ea silentlycontinue | Out-Null
Last edited: Today at 7:40 AM
Why not read posts carefully?
Deleting useless files in Disk Cleanup are helpful especially with the limited spaces that SSDs usually have.

How to free up space automatically using Storage Sense feature​

Windows 10 / 11 has designed the Storage Sense feature in Settings to help you automatically free up space when your hard drive or SSD is low on disk space.​

Step 1:
Open Settings in Windows 10 / 11 by pressing Win + I, and then choose System.
choose System
Step 2:
Select Storage on the left. Then turn on the Storage sense button, so Windows 10/ 11 will automatically free up space by getting rid of unneeded files, like temporary files and content in your recycle bin.
turn on storage sense
Step 3:
Click Change how we free up space automatically under the Storage sense.
free up space automatically
Step 4:
Now you can choose how often to run Storage sense automatically and when to delete the temporary files automatically.
choose when to free up space
Hint:

In fact, Windows and other programs generate more types of temporary files, log files and data caches on your system drive that the native Disk Cleanup utility and Storage sense cannot reach. Therefore, if you want to free up more space on your SSD, it's recommended that you use a third-party PC cleaning tool like iSumsoft System Refixer to clean your SSD more deeply.

Screenshot:
1684233731429.png
Last edited: Today at 11:41 AM

persona78

Senior Member
Apr 12, 2013 2,532 1,303
Deleting useless files in Disk Cleanup are helpful especially with the limited spaces that SSDs usually have.

How to free up space automatically using Storage Sense feature​

Windows 10 / 11 has designed the Storage Sense feature in Settings to help you automatically free up space when your hard drive or SSD is low on disk space.​

Step 1:
Open Settings in Windows 10 / 11 by pressing Win + I, and then choose System.
choose System
Step 2:
Select Storage on the left. Then turn on the Storage sense button, so Windows 10/ 11 will automatically free up space by getting rid of unneeded files, like temporary files and content in your recycle bin.
turn on storage sense
Step 3:
Click Change how we free up space automatically under the Storage sense.
free up space automatically
Step 4:
Now you can choose how often to run Storage sense automatically and when to delete the temporary files automatically.
choose when to free up space
Hint:

In fact, Windows and other programs generate more types of temporary files, log files and data caches on your system drive that the native Disk Cleanup utility and Storage sense cannot reach. Therefore, if you want to free up more space on your SSD, it's recommended that you use a third-party PC cleaning tool like iSumsoft System Refixer to clean your SSD more deeply.

Screenshot:

View attachment 5911889

... and have you try the batch to see what it does????...
Just asking!?

PS: Don´t forget 1.ps1! A few clicks need .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK