Solved

Creating schtasks with arguments

Posted on 2011-03-11
5
2,931 Views
Last Modified: 2012-05-11
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
Comment
Question by:Haydan
  • 4
5 Comments
 
LVL 16

Accepted Solution

by:
sjklein42 earned 250 total points
ID: 35112161
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
 

Author Comment

by:Haydan
ID: 35112210
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
 

Assisted Solution

by:Haydan
Haydan earned 0 total points
ID: 35112362
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
 

Assisted Solution

by:Haydan
Haydan earned 0 total points
ID: 35113020
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
 

Author Closing Comment

by:Haydan
ID: 35145575
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now