FAQ Using - How do I schedule a task, to run automatically every day?
It's a great idea to run MyDefrag automatically every day by adding it to the
Windows scheduler. The MyDefrag installer has an option to create a schedule for the
Daily and Monthly scripts, or you can create a schedule yourself, like this:
2000, XP
- Start -> Settings -> Control Panel -> Scheduled Tasks
- Double-click the "Add Scheduled Task" icon.
- The wizard starts, click "Next".
- Use the "browse" button to select the "*.MyD" script that you want to run, for
example "c:\Program Files\MyDefrag v4.3.1\Scripts\Daily.MyD".
- Select "daily", next, select a time, next.
- Enter a userid/password with administrator privileges, click "Finish".
Vista
- Start -> Settings -> Control Panel -> Administrative Tools -> Task Scheduler
- In the program select "Create Basic Task".
- When asked to select a "Program/Script" select the "*.MyD" script that you want
to run, for example "c:\Program Files\MyDefrag v4.3.1\Scripts\Daily.MyD".
Leave the arguments and "start in" fields empty.
Notes
- The examples above will create a task for a .MyD script. This will only work if
there is an association between .MyD scripts and the MyDefrag script interpreter,
which is created by the MyDefrag installer (see the "Associate .MyD files with the
MyDefrag script interpreter" option).
Without the association you can still create a scheduled task, but then you will
have to point to the MyDefrag.exe executable and specify the script with the "-r"
commandline parameter. For more information see the Commandline chapter on the
Scripts manual page.
- Windows will refuse to create a task for a userid if the password of that
userid is empty.
- The Daily, Weekly, and Monthly scripts that come with MyDefrag will automatically exit
when they are finished. The other scripts do not. To do this you have to change the script
and add the WhenFinished setting.
- See the "Settings" of the scheduled task to run only when the computer
is idle.
- To start the task minimized see the MyDefrag WindowSize
script setting.
- Use the OtherInstances "exit" setting to make
sure that two scripts do not run simultaneously.
Tip: schedule your Monthly script to start 1 minute before the Daily script. The Daily
script will then immediately exit because the Monthly script is already running.
- In some circumstances it can be preferable to run MyDefrag with "system"
privileges (instead of administrator privileges). Create a task and enter
the string "NT AUTHORITY\SYSTEM" for the userid, and no password.
- Administrators can create tasks from the commandline with the Windows
"schtasks" command.
See also:
Frequently Asked Questions