/cleanmgr /sagerun in batch scripts

Page 5 of 5 FirstFirst ... 345

  1. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #41

    Denis,

    Thanks for the reply and information.

    Just out of curiosity, and I know that you can have more than one StateFlags number in the Registry Key for use on different drives for example, but have you got an entry purely for StateFlags with NO Number next to it as shown below ?

    This is something that I have NOT added, so I assume that it is the Default entry.

    /cleanmgr /sagerun in batch scripts-image.png
      My Computer


  2. Posts : 1,223
    W10-Pro 22H2
       #42

    Paul Black said:
    Just out of curiosity, and I know that you can have more than one StateFlags number in the Registry Key for use on different drives for example, but have you got an entry purely for StateFlags with NO Number next to it as shown below ?
    I have one - see post #6 /cleanmgr /sagerun in batch scripts
      My Computer


  3. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #43

    Thanks @mngerhold,

    mngerhold said:
    I have one - see post #6 /cleanmgr /sagerun in batch scripts
    That is useful information.

    I wonder if Denis has the same !

    I really am clutching at straws over this problem now, NOT just for us and the OP, but for anyone who comes across this problem in the future.

      My Computer


  4. Posts : 1,223
    W10-Pro 22H2
       #44

    I thought I'd see what other reports of this hanging issue existed, so searched - and a comment on a google group had me trying to run from the command line, not from a batch file - and it worked without hanging.

    So I then tried the batch file: OK

    I tried running sageset, and noticed that it was now remembering my settings (up to now it had defaulted to 2 other options which I didn't want - but cannot now recall). Subsequent sagerun's all worked fine.

    The only thing I can think of is that I had to do a restart the other day (don't do them often). Has that fixed some glitch? Time alone will tell. Martin
      My Computer


  5. Posts : 18,044
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #45

    I just ran cleanmgr.exe /sagerun:9999 [ it runs C:, D:, & I: ] from an Elevated CMD Prompt and the cleanmgr box appeared and then disappeared, BUT, when I looked in Task Manager, it STILL shows it as running ! . . .
    /cleanmgr /sagerun in batch scripts-image.png
      My Computer


  6. Posts : 16,950
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #46

    Paul Black said:
    ... have you got an entry purely for StateFlags with NO Number next to it as shown below ?
    Yes.

    Here is the set of non-numbered StateFlags entries I found on a computer I had not yet got around to setting up for CleanMgr.
    Original StateFlags.reg.txt

    Denis
    Last edited by Try3; 30 Aug 2022 at 10:28.
      My Computer


  7. Posts : 1,223
    W10-Pro 22H2
       #47

    stateflags with no number:

    on a whim (and with an idea of what I might find), I tried:
    1. Check stateflags with no number: all set to 1 (well, those I checked)
    2 run cleanmgr interactively - all items are initially set (I think), clearing all bar 2 of them
    3. check stateflags: all 'std' ones set to 0, bar the two I left, which are set to 1
    4. run cleanmgr interactively: all settings as I left them.

    So there you have it!
      My Computer


  8. Posts : 1
    win11
       #48

    hello experts! :)
    Has someone managed to circumvent the stuck cleanmgr ?
    i tried every hint here on windows 11 but it's still the same issue : cleanmgr is waiting on the last item asked to clean and then a mouseover closes the program.

    Thanks!

    - - - Updated - - -

    samn3rt said:
    hello experts! :)
    Has someone managed to circumvent the stuck cleanmgr ?
    i tried every hint here on windows 11 but it's still the same issue : cleanmgr is waiting on the last item asked to clean and then a mouseover closes the program.

    Thanks!
    Update :
    my goal was to clean old windows update in unattended.
    i have found this to be a workaround for my cleaning needs:

    Dism.exe /online /Cleanup-Image /StartComponentCleanup


    Code:
    try {
        # start the  dism.exe process 
        $process = Start-Process -FilePath "dism.exe" -ArgumentList "/online /Cleanup-Image /StartComponentCleanup" -PassThru -Wait
    
        Write-Output "exit code : $($process.ExitCode)"
    } catch {
        # show the error
        Write-Error "An error occured while running dism.exe : $_"
    }
      My Computer


  9. Posts : 6,343
    Windows 11 Pro - Windows 7 HP - Lubuntu
       #49

    How to automatically run Disk cleanup on Windows 7, 8.x and 10

    Create a script of what disk cleanup should periodically and automatically clean. (Step 1)
    Call the script on your batch file

    call cleanmgr.exe / sagerun:7
      My Computers


 

  Related Discussions
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 07:23.
Find Us




Windows 10 Forums