• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3185
  • Last Modified:

Creating schtasks with arguments

I'm trying to use schtasks to create a schedule to run a program every hour between 10:30 and 16:30. The program needs some arguments so that it runs silently in the task bar without disturbing people.

The program its schedules to run is an update program that needs to run regularly to ensure clients have the latest version. I also want it to override previous schedules with new ones if I decide 1 hour is to much or not often enough.

The line referably wants to run in both WinXP through Win7, however I can have it run a few different lines for different OS's if nessasary.

The program executing this is AutoUpdatePlus

I have this command line:

schtasks /create /tn "Intertek Updates" /tr "C:\Import Program\ITS Import Program\Updates\Intertek Workbooks Upd.exe /Tray /TimerIntro /TimerFinal" /sc HOURLY /st 10:30:00 /et 16:30:00 /it /f

However when I run this it puts "C:/Import" into file and the rest "Program\ITS Import Program\Updates\Intertek Workbooks Upd.exe /Tray /TimerIntro /TimerFinal" into arguments.

Also under XP the stop time "/et 16:30:00" does not work, is there a way to se t astop time in XP?

Thanks
0
Haydan
Asked:
Haydan
  • 4
3 Solutions
 
sjklein42Commented:
Create a simple batch file containing your command line, and schedule that batch file instead of the raw command line.

I don't know about the stop time.
0
 
HaydanAuthor Commented:
Even if I manually place that line into cammond it doesn't work I get;

"C:/Import" into file and the rest "Program\ITS Import Program\Updates\Intertek Workbooks Upd.exe /Tray /TimerIntro /TimerFinal" into arguments.

I'm not sure how to handle spaces and adding the arguments /tray /timer .....

Oh wait I see what your saying run a damn batch file that runs the program with the arguments here, mush like the one I already have set up!

That'd work but I would still like to run it like this if possible...
0
 
HaydanAuthor Commented:
OK got the hardest part now from:

http://support.microsoft.com/kb/823093

Trick is to use \" to surround the first part of it and leave the rest out the end. So far this sets it up perfect in Windows 7

schtasks /create /tn "Intertek Updates" /tr "\"C:\Import Program\ITS Import Program\Updates\Intertek Workbooks Upd.exe\" /Tray /TimerIntro /TimerFinal" /sc HOURLY /st 10:30:00 /et 16:30:00 /f /it

Now just to get it working in XP which doesn't appear to have the /et argument
0
 
HaydanAuthor Commented:
Doesn't look as though WinXp is very good at this. IN the end I have an open "run it every hour" schedule. I also have to delete the old schedule everytime so that it can update teh schedule, heres what I used:

schtasks /delete /tn "Intertek Updates" /f

and

schtasks /create /tn "Intertek Updates" /tr "\"C:\Import Program\ITS Import Program\Updates\Intertek Workbooks Upd.exe\" /Tray /TimerIntro /TimerFinal" /sc HOURLY /st 10:30:00 /ru system

(/ru system runs the schedule without a password)
0
 
HaydanAuthor Commented:
sjklein solution would probably be the easiest and most logical way to go but I wanted to do in a more streamlined way whcih I eventually worked out.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now