Solved

Creating schtasks with arguments

Posted on 2011-03-11
5
3,034 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

734 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