Solved

Creating schtasks with arguments

Posted on 2011-03-11
5
2,963 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

First some basics on Windows 7 Backup.  It has 2 components one is a file based backup which is stored in .zip files each zip is split at around 200 Megabytes and there is the Image Backup which is as the name implies a total image of the partition …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

785 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