/cleanmgr /sagerun in batch scripts

Page 3 of 5 FirstFirst 12345 LastLast

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

    Denis,

    Try3 said:
    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.
    That could very well be the reason. So now, we need to investigate a solution to overcome that behaviour, if there is one of course.

    It will be interesting to see if @Beasticles and @mngerhold noticed similar results to mine when they run theirs, and if they did NOT notice, then perhaps they could run cleanmgr again and report back.

    Obviously running yours from a Shortcut appears to by-pass this behaviour.
      My Computer


  2. Posts : 17,032
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #22

    Paul,

    Try creating the shortcut [containing the command] then, in your batch file, run the shortcut rather than the command itself.

    Denis
      My Computer


  3. Posts : 1,227
    W10-Pro 22H2
       #23

    Paul Black said:
    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.
    Yes, I see that - for me, the active window has a green title bar, inactive blue. The 'frozen' Cleanmgr window is indeed green, and the CMD (console window host) window is blue - when I hover over the frozen window, it vanishes, and shortly after the CMD window turns green, then vanishes itself as (if) the job completes. I think this is expected behaviour, if indeed the Cleanmgr window is waiting for input (however silly that is).

    I shall be adding more...
      My Computer


  4. Posts : 1,227
    W10-Pro 22H2
       #24

    Denis: running a shortcut or the batch file direct makes no difference for me. But I have been trying other things - here goes: I have found at least 3 actions that will send the frozen Cleanmgr window on its way:
    (i) Hovering over it - the job completes, and all is well
    (ii) hitting any key, regardless of where the cursor is - OK[*]
    (iii) left-clicking anywhere on screen: bad news!

    If I do 3, the CMD window stays open, and I can see Cleanmgr still running in Process explorer and under 'details' in Task Manager: this shows my explorer window, and the contents of the sagerun script (fwiw !):
    /cleanmgr /sagerun in batch scripts-cleanmgr-1.jpg
    This second screen capture shows what PE and TM see:
    /cleanmgr /sagerun in batch scripts-cleanmgr-2.jpg

    If I then close the CMD window with the X in the top-rt corner, or end the task with TM, Cleanmgr is left still running:
    /cleanmgr /sagerun in batch scripts-cleanmgr-3.jpg

    In this condition, subsequent attempts to run sagerun or indeed sageset have no visible effect - it is broken. This is the result of running sageset:
    /cleanmgr /sagerun in batch scripts-cleanmgr-4.jpg and
    /cleanmgr /sagerun in batch scripts-cleanmgr-5.jpg

    I have to kill the cleanmgr process (from TM or PE) to get back to normal.

    I have no idea what is broken, but this explains why I had such trouble yesterday - Cleanmgr was still running, and when I launched it a second, third or fourth time, the behaviour was weird. So this has been fun, but I don't know if I have learnt anything other than to be nice to active windows!
    [*] The reason hitting a key works is that, with the Cleanmgr window active (as I have not clicked anything else yet), the input goes to Cleanmgr and it is happy.
    Last edited by mngerhold; 28 Aug 2022 at 11:38.
      My Computer


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

    mngerhold said:
    Denis: running a shortcut or the batch file direct makes no difference for me.
      My Computer


  6. Posts : 17,032
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #26

    Paul,
    Martin,

    I assume that if you run the shortcut on its own, albeit just for test purposes, it behaves itself.

    I don't have any other suggestions.

    I just run CleanMgr on its own from that shortcut when I feel like it, commonly once a month.
    I don't even have Task scheduler triggering it.

    All the best,
    Denis

    Martin - I do have a slot in my calendar to post samples of variable-reporting-back [the excellent Tom Lavedas method]. It's just that I've been a bit snowed under so I keep moving the slot to the day after tomorrow.
      My Computer


  7. Posts : 18,034
    Win 10 Pro 64-bit v1909 - Build 18363 Custom ISO Install
       #27

    Denis,

    Try3 said:
    I assume that if you run the shortcut on its own, albeit just for test purposes, it behaves itself.
    Strangely enough, NO.

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


  8. Posts : 1,227
    W10-Pro 22H2
       #28

    Try3 said:
    Paul, Martin, I assume that if you run the shortcut on its own, albeit just for test purposes, it behaves itself.
    No !
    Try3 said:
    Martin - I do have a slot in my calendar to post samples of variable-reporting-back [the excellent Tom Lavedas method]. It's just that I've been a bit snowed under so I keep moving the slot to the day after tomorrow.
    I assume you are referring to variables when running vbs? If so, get that slot prioritised!
      My Computer


  9. Posts : 17,032
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #29

    Martin - I did not see those diagrams in your previous post as I wrote my reply. I'll take a look at them now. Denis
      My Computer


  10. Posts : 17,032
    Windows 10 Home x64 Version 22H2 Build 19045.4170
       #30

    Martin,

    I run SageSet as Admin. Perhaps that's what saves me?
    Try3 said:
    There are two steps & two steps only:-

    Step 1 - Once-only setting up command in an elevated command window - the dialog containing checkboxes appears for you to select the items you want cleared in future SageRun:1 operations.
    Code:
    cleanmgr.exe /sageset:1

    Step 2 - Routine command to use in an elevated command window or shortcut thereafter whenever you want to clean disks
    Code:
    cleanmgr.exe /sagerun:1



    Doesn't the dialog of checkboxes appear when you run SageSet:NNN?



    It's only speculation but, in case previous attempts have messed things up, check
    HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches
    for all StateFlags0096 entries and delete them.
    That, I think, should make the dialog appear again for SageSet so you can start again from scratch
    /cleanmgr /sagerun in batch scripts-all-options-selected-trimmed.png


    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 06:03.
Find Us




Windows 10 Forums