Intro Download and install Frequently Asked Questions Tips and tricks

Homepage







© J.C. Kessels 2009
MyDefrag Forum
May 24, 2013, 08:55:35 am *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Creating Scheduled Tasks at Installation  (Read 1289 times)
MikeRepairs
JkDefrag Junior
**
Posts: 7


View Profile
« on: July 23, 2009, 06:26:34 pm »

Thanks for the great program. I install it on a few computers every day.

It would be great if you add one more Scheduled task option when installing.
When installing, there is a "Select Additional Tasks" window.
There is a check box for "Create a scheduled task for Fast Update script Every Day at 5:00AM"
I would like to also have another check box for "Create a scheduled task for Slow Optimize script Monthly on the 1st at 2:00AM".

Then I would check both boxes on every install (since your FAQ says this is a good strategy).
Is this something you can add?

Thanks for any help.
Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #1 on: July 23, 2009, 08:22:44 pm »

Thanks for sharing your idea, I appreciate it. But I don't think a fixed schedule for SlowOptimize is a good idea. I think it's better to leave it up to the user, to run it by hand. Also, I think that many users would get confused if there are 2 options in the setup.

Tip: it's very easy to create a schedule from the Windows commandline. You could create a little .bat file that creates all the schedules you want (and perhaps automatically installs MyDefrag, see the "Installer commandline parameters" chapter on the    
Download and install
page). This is the command that the setup program uses:
Code:
Schtasks.exe /create /Tn "MyDefrag FastUpdate" /tr "\"C:\Program Files\MyDefrag v4.1\Scripts\FastUpdate.MyD\"" /sc daily /st 05:00
Logged
MikeRepairs
JkDefrag Junior
**
Posts: 7


View Profile
« Reply #2 on: July 23, 2009, 09:15:50 pm »

Thanks for the command line info. I can use that then.

Logged
MikeRepairs
JkDefrag Junior
**
Posts: 7


View Profile
« Reply #3 on: July 24, 2009, 09:58:51 am »

Here is what I came up with...

This is code for a .bat file that will make two scheduled tasks.
1) Fast Update Every Day at 5:00AM
2) Slow Optimize Monthly on the 1st at 2:00AM

Note: If the program version changes in the future to a newer version higher than 4.1, you have to edit the "set myd" path to the new version number before using this script or else you will see a file path error when you run it.

Note: If you upgrade MyDefrag to a newer version higher than 4.1, be sure to delete the two tasks in Control Panel - Scheduled Tasks, edit the "set myd" path with the new version number, then run this script again.

Code:
@echo off
title MyDefrag Task Schedule Creator
cls
cd /d %~dp0

set myd=%systemdrive%\Program Files\MyDefrag v4.1\Scripts

echo --------------------------------------------------------
echo Batch Script by Mike Challis MikeRepairsComputers.com
echo --------------------------------------------------------
echo.
echo --------------------------------------------------------
echo Creating MyDefrag FastUpdate Task to run Daily at 5:00AM
echo --------------------------------------------------------
if exist "%myd%\FastUpdate.MyD" schtasks.exe /create /Tn "MyDefrag FastUpdate" /tr "\"%myd%\FastUpdate.MyD\"" /ru "SYSTEM" /sc daily /st 05:00:00
if not exist "%myd%\FastUpdate.MyD" echo ERROR "%myd%\FastUpdate.MyD" not found
echo.
echo -----------------------------------------------------------------------
echo Creating MyDefrag SlowOptimize Task to run Monthly on the 1st at 2:00AM
echo -----------------------------------------------------------------------
if exist "%myd%\SlowOptimize.MyD" schtasks.exe /create /Tn "MyDefrag SlowOptimize" /tr "\"%myd%\SlowOptimize.MyD\"" /ru "SYSTEM" /sc monthly /st 02:00:00
if not exist "%myd%\SlowOptimize.MyD" echo ERROR "%myd%\SlowOptimize.MyD" not found
echo.
echo off
Pause
« Last Edit: July 24, 2009, 10:08:26 am by MikeRepairs » Logged
jeroen
Administrator
JkDefrag Hero
*****
Posts: 7155



View Profile WWW
« Reply #4 on: July 24, 2009, 10:06:11 am »

Thanks for sharing your .bat file, I appreciate it. You mentioned before that you wanted to create the schedule(s) together with installing the program, so I was expecting you to also install MyDefrag from the .bat (perhaps using the /SILENT flag), but maybe you decided against it.
Logged
MikeRepairs
JkDefrag Junior
**
Posts: 7


View Profile
« Reply #5 on: July 24, 2009, 10:12:55 am »

I guess I just prefer to install the program regularly, I do not mind that part.  Smiley

PS I wanted to make both the schedules fully automated, my customers would most likely forget to run the slow optimize monthly. I understand you wanting to keep it simple with the installation options. This bat file will fill my needs just fine.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.5 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!