/cleanmgr /sagerun in batch scripts

Page 2 of 5 FirstFirst 1234 ... LastLast

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

    If you want to see the VolumeCaches [ StateFlags ] that appear in the Registry, Copy & Paste the following command into a CMD Prompt and press Enter.

    Code:
    
    @echo off & echo. & for /f "usebackq tokens=8 delims=\" %i in (`REG Query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches`) do echo %i
      My Computer


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

    Paul,

    Paul Black said:
    Surely that only sets the Default StateFlags items if you have NOT already changed them [ Checked or Unchecked ] !
    The dialog for setting the checkboxes appears as part of running this command.

    But the [trimmed] exported .reg file afterwards can set it all up again for the SageSet:NNNN number used to match those choices without any dialog being involved.
    So I used my [trimmed] exported .reg file to transfer my settings from one computer, where I'd done the work, to all my other computers. I could then run the same SageRun:NNNN command on the others.
    The trimming is just to remove all the other entries from the relevant Reg key because they are involved in several other [unknown] functions.

    Paul Black said:
    Do you have to hover over the box for it to disappear ?
    No.
    It does its job and closes when it's done, like almost every other command or batch file.

    All the best,
    Denis
      My Computer


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

    Oh, while we're on the subject of CleanMgr, an apparently well-regarded individual called Fred Langa conducted experiments that demonstrated that Registry cleaners do not add one jot to the cleaning up that routine application uninstallations & CleanMgr do.
    About Temporary Files and Registry Junk Data Slow Down - CleanMgr does the job - TenForums
    See the article Callender linked to in post #5.

    I had never before seen experimental evidence of Registry cleaners being snake oil.

    All the best,
    Denis
      My Computer


  4. Posts : 3
    Windows 10 21H2
    Thread Starter
       #14

    Thank you all for your input, ill try my best to try all of these attempts including the running cleanmgr on its own again in different ways.. For context, I have done all the ways that were forementioned, even cleanmgr on its own and the windows still hang until I hover over them. I have yet to mess with registry keys or use freebooter's script. Again, my batch files run without human intervention just fine, until I incorporate disc cleanup in any fashion. Ty guys!
      My Computer


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

    Hello @Beasticles,

    Beasticles said:
    I have yet to mess with registry keys or use FreeBooter's script.
    Just a word of WARNING.

    FreeBooter's Script ALSO cleans up the Temp files, DELETES the oldest Shadow Copy on drive C, and cleans up the Event Viewer Logs etc.

    I hope this helps.
      My Computer


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

    Beasticles said:
    ill try my best to try all of these attempts including the running cleanmgr on its own again in different ways.
    Try3 said:
    There are two steps & two steps only:-

    Step 1 - Once-only setting up command in an elevated command window
    Code:
    cleanmgr.exe /sageset:1

    Step 2 - Routine command to use thereafter whenever you want to clean disks
    Code:
    cleanmgr.exe /sagerun:1
    Try3 said:
    The dialog for setting the checkboxes appears as part of running the first [SageSet] command.
    If you run those two steps on their own [without your batch file] you should see CleanMgr running & finishing without any human intervention during the second step [and the first step never needs to be repeated].


    Best of luck,
    Denis
      My Computer


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

    I cannot explain anything, but numerous tests with sageset and sagerun show that (for me) sagerun sometimes stalls on the 'temporary internet files' cleanup stage, and hovering over the window is required to allow it to continue - so there is definitely a bug of some sort, but I can't get consistent behaviour.

    Just tried running Process Explorer to shed light (maybe): when the sagerun process is hanging on the 'temp internet files' window, PE shows several threads which are apparently waiting for user input (wait:WrUserRequest). Sometimes just accessing PE unhangs things, or simply clicking on empty desktop. Go figure! I think I shall walk away from this, as it's beyond me.

    oh - except that when I closed various windows (NP++, explorer) a lot of cleanmgr windows flashed before my eyes!
      My Computer


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

    Hello @mngerhold,

    mngerhold said:
    oh - except that when I closed various windows (NP++, explorer) a lot of cleanmgr windows flashed before my eyes!
    That is why I always close EVERYTHING before I run my weekly cleanup Script to avoid any unusual behaviour and to allow the computers full resources to be available for the cleanup processes.
      My Computer


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

    OK.

    I have been performing some tests to try and get to the bottom of why there is a delay in continuing to run cleanmgr for some, until they hover over the cleanmgr box, and NOT for others.

    I did find something very interesting which I believe is a contributing factor, if NOT the reason, for this behaviour.

    These are my findings when cleanmgr is run in a Script along with other commands, or run in a Script on its own.

    When the cleanmgr box appears, the CMD Prompt visually changes. By this, I mean that the Title Bar does NOT show as the Active screen and has a lighter appearance. When you hover over the cleanmgr box, the CMD Prompt shows as the Active screen and continues.

    Perhaps someone can confirm if this is also the case for them !

    I have tried to explain this as best I can.
      My Computer


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

    Paul,

    Having previously used SageSet:1 to set up the options {without defining a drive i.e. for all drives}, I run CleanMgr from a shortcut
    C:\Windows\System32\cleanmgr.exe /sagerun:1
    and I do not see any cmd window. I see minimised Disk cleanup tabs in my Taskbar and they disappear when their job is done.
    /cleanmgr /sagerun in batch scripts-screenshot-1692-.png - It starts off with a single drive [I assume it's the OS drive], then
    /cleanmgr /sagerun in batch scripts-screenshot-1693-.png - it gets into its stride and cleans multiple non-OS drives in parallel, then
    /cleanmgr /sagerun in batch scripts-screenshot-1694-.png - it finishes.

    I wonder if what you've described is that the cmd window is indeed not the active window because the active window is a Disk cleanup one.

    All the best,
    Denis
      My Computer


 

  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 01:34.
Find Us




Windows 10 Forums