1.    16 Jun 2017 #1
    Join Date : Jul 2015
    Posts : 18
    Windows 7

    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.    17 Jun 2017 #2
    Join Date : Oct 2014
    Trnava
    Posts : 2,856
    Windows 10.4 Home 1709 x64

    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
    Join Date : Jul 2015
    Posts : 18
    Windows 7
    Thread Starter

    Quote Originally Posted by TairikuOkami 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

 


Similar Threads
Thread Forum
Will these batch files work to change DNS servers to OpenDNS and back?
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...
Network and Sharing
Need help with batch file
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...
General Support
Batch File Help
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...
Software and Apps
How to change visual effects using batch file or registry file?
Hi there forum, how do you change the Visual effects using a batch file or registry file. Thanks, Edward.
General Support
why at every boot , there is a schedule for MRT.exe & cleanmgr.exe?
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
Performance & Maintenance
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 11:03.
Find Us
Twitter Facebook Google+ Ten Forums iOS App Ten Forums Android App



Windows 10 Forums