Updated 02-25-2020 - Added parameter and switch command example details. - Corrected a few typos. - Added additional code improvements
Updated 03-13-2020 - Added the ability to remove all event logs and event tracer log files to the -Include parameter. - Changed the -Include parameter 'Restore Points' to 'RestorePoints' for convenience. - Additional contextual modifications.
Updated 04-19-2020 - Added the ability to remove all outdated and duplicate device drivers selectively to the -Include parameter. - Additional code improvements.
Maybe You want read these two posts https://forums.mydigitallife.net/threads/start-windowscleanup.80284/#post-1559104 https://forums.mydigitallife.net/threads/start-windowscleanup.80284/#post-1574888
Updated 05-03-2020 - Added a -GUI switch, that can be used in place of the -Include parameter, that outputs a Gridview GUI list of all of the values in the -Include parameter allowing for the selection of items to include in the removal process as opposed to manually entering them.
Updated 05-09-2020 - Updated the code to include a new helper function to eliminate the redundant service and process stopping loops. - Included the clean-up of Microsoft Edge Chromium content in addition to the previously present Microsoft Edge HTML content. - The verification for the removal of downloaded content is now a messagebox utilizing Microsoft's PresentationFramework.
It's not working because of space in the file pathname, make sure there are no spaces in files, and path names.
Now you changed the .ps1 file name to clean.ps1 but you didn't change the content in the .cmd keep the file name as Start-WindowsCleanup.ps1 and then run .cmd file again. Verify that you have properly copied the .ps1 content from the OP. If still not working then zip that folder with those 2 files and share here.
@Windows_Addict I want to pass parameters to the batch script. Is the following script correct? Code: @echo off reg query HKU\S-1-5-19 1>nul 2>nul || ( echo ==== Error ==== echo Right click on this file and select 'Run as administrator' echo Press any key to exit... pause >nul exit /b ) REM File name Function name powershell -ExecutionPolicy ByPass -command ". "%~dp0Start-WindowsCleanup.ps1"; Start-WindowsCleanup -Include Downloads -ComponentCleanup;" pause