how to set task scheduler to run disk cleanup and automatically respond to popup window using 'Enter' key

1

I'd like to schedule a task running windows application 'Disk Cleanup', but how to automatically respond to the popup windows using 'Enter' key?

Victor

Posted 2015-03-13T18:19:40.890

Reputation: 153

Answers

1

Open a command prompt in order to configure your 'cleanmgr' settings and enter:

"cleanmgr /sageset:999"

this will open a one-time settings window which will associate the '999' to the specific settings that you want the command to have You can choose any number you want from 0-65535.

Check the combo box options that you want to implement for your customized disk cleanup operation. This will create a registry link and will save your settings for future use.

The registry settings may take a few minutes to become active. A reboot will reload the registry for you with more assurance.

Then open Task Scheduler and select "Create Basic Task" from the actions pane.

Give the task a name such as "my_cleanup". Add a description if you want to.

Select the trigger (when it will run) that you want. You can add multiple triggers after the task is created.

Select "Start a program" in the action window.

Enter 'cleanmgr' into the Program/Script textfield and 'sagerun:999' into the "Add arguments (optional)" textfield. The program will not need any user input when it runs because the settings are saved into the registry from when you ran the sageset argument.

Further reading can be found at cleanmgr info and at this microsoft page.

Dean Spicer

Posted 2015-03-13T18:19:40.890

Reputation: 611