Windows 10: Why won't cleanmgr work in a batch file

  1.    16 Jun 2017 #1

    Why won't cleanmgr work in a batch file


    I've previously run cleanmgr /sageset:1 and checked everything including Recycle Bin.

    If I run cleanmgr /sagerun:1 from a command prompt, the Recycle Bin is emptied. If I put that command it a batch file, let's say test.bat and run said file without the involvement of a command prompt, the Recycle Bin is not emptied.

    There may or may not be other things that are or are not cleaned. The Recycle Bin is just the first that I noticed and the simplest to experiment with.
      My ComputerSystem Spec


  2. Posts : 3,143
    10.5 Home 1803 x64
       17 Jun 2017 #2

    If I use this command, it works, but still have to set it first using: cleanmgr /sageset:65535

    cleanmgr /sagerun:65535

    But I gave up on WIndows doing the right way and I just do it myself anyway:

    del "C:\$Recycle.bin\*" /s /f /q
    del "D:\$Recycle.bin\*" /s /f /q
    del "E:\$Recycle.bin\*" /s /f /q
      My ComputerSystem Spec

  3.    17 Jun 2017 #3

    TairikuOkami said: View Post
    If I use this command, it works, but still have to set it first using: cleanmgr /sageset:65535

    cleanmgr /sagerun:65535

    But I gave up on WIndows doing the right way and I just do it myself anyway:

    del "C:\$Recycle.bin\*" /s /f /q
    del "D:\$Recycle.bin\*" /s /f /q
    del "E:\$Recycle.bin\*" /s /f /q
    I don't see that that command using 65535 works any differently than mine using 1, i.e. it empties the Recycle Bin if invoked at a command prompt, but not if invoked from a batch file.

    I guess, like you, I'll adopt a different strategy for the Recycle Bin. Hopefully cleanmgr cleans up the rest of what it is supposed to.
      My ComputerSystem Spec


 

Related Threads
I found the following on a forum post from 2007. I'm apprehensive, however, to try it because I obviously don't want to cause anything to stop working properly. 1: netsh interface ip set dns "Local Area Connection" static 208.67.222.222 netsh...
Need help with batch file in General Support
No serious Batch file or scripting experience, so bear with me. We use a site for our business that has to run on IE and has to have the cache cleared a certain way sometimes for it to function. We have to go IE options, uncheck delete history on...
Batch File Help in Software and Apps
I've never dabbled much in batch files, as I've usually been able to find pre-made ones to do what I wanted. We have an application that handles user data backups. It has three services, and at times, one or two of the three don't start...
Hi there forum, how do you change the Visual effects using a batch file or registry file. Thanks, Edward.
hi why when i start windows 10 pro last updated ,64bit pro , after some minutes windows 10 starts these processes C:\Windows\System32\cleanmgr.exe C:\Windows\System32\MRT.exe DismHost.exe is it normal ? thanks
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 15:25.
Find Us