Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Creating schtasks with arguments

Posted on 2011-03-11
5
Medium Priority
?
3,118 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 1000 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

OfficeMate Freezes on login or does not load after login credentials are input.
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Suggested Courses

730 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