Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

DOS/Other DOS/Other
Search Search
Search for:
Tech Support Guy > > >

Help Needed to schedule a task thru dos prompt


(!)

kunjikorans's Avatar
kunjikorans kunjikorans is offline
Member with 148 posts.
THREAD STARTER
 
Join Date: Dec 2008
11-Dec-2008, 08:30 AM #1
Help Needed to schedule a task thru dos prompt
I am using Win Xp Sp2 ..
I have created a file for eg " abc.xyz". How do I schedule to run this file at specific times using dos prompt/command prompt?

I want to run this file --- c:\abc.xyz at specific times and daily ..

Can anybody show what should be typed specifically in the cmd prompt??


Regards,
Sachin
TheOutcaste's Avatar
Computer Specs
Member with 9,028 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
11-Dec-2008, 09:32 AM #2
AT 13:05 /every:M,T,W,TH,F,S,SU c:\abc.xyz

Runs the file at 1:05 PM every day
For multiple times you have to create a new job for each time.
Days of the week can be a day M,T,W,Th,F,S,Su or a number 1-31
AT /? in a command prompt for syntax

Or use SCHTASKS:

SCHTASKS /Create /SC DAILY /RU user /RP password /ST 13:00:00 /ST 15:00:00 /TN MyFile /TR C:\abc.xyz

This runs the task under the user account at 1PM and 3PM every day.
SCHTASKS /? or SCHTASKS /Create /? in a command prompt for syntax

Also see Command-line reference A-Z

HTH

Jerry
kunjikorans's Avatar
kunjikorans kunjikorans is offline
Member with 148 posts.
THREAD STARTER
 
Join Date: Dec 2008
11-Dec-2008, 12:39 PM #3
Hi Jerry,
Thanx for ur help...
Let me be more specific ..
I am the administrator, I have no other usernames ... and no passswords when I loggon to windows. I want to run a batch file that i have created.. cing.bat.

I want this file to run everyday from 2am to 5pm at every 15 mins interval.
I tried ur suggestions but it didnt work
TheOutcaste's Avatar
Computer Specs
Member with 9,028 posts.
 
Join Date: Aug 2007
Location: Oregon, USA
Experience: Intermediate
11-Dec-2008, 01:21 PM #4
Quote:
Originally Posted by kunjikorans View Post
and no passswords
There's the problem. You must have an account with a password to be able to schedule a task, at least using schtasks or Control Panel | Scheduled Tasks. I've never tested the AT command to see if you have to have a passworded account to create a job. The actual job it creates uses the system account so I wouldn't think it necessary, but you'd have to create 60 jobs to use the AT command.

Is there a reason this has to be done from the command prompt?

You can create a task using the Task Scheduler and just point it to the batch file. Much easier than trying to use the command line.
If you want it to run minimized, you have to create a shortcut to the batch file and set it to run minimized. It will still appear on the taskbar.
To hide it completely, you'd need to use a 3rd party app like Hidden Start or use VBS.

Schtasks will work to create the task, but you can't specify an end time. You'd have to edit the schedule by using Control Panel | Scheduled Tasks
This will create the task, then you can add the Run Until time via Control Panel | Scheduled Tasks
SCHTASKS /Create /SC MINUTE /MO 15 /ST 02:00:00 /TN PingTest /TR C:\ping.bat

You can create another user account that is a Computer Administrator and give it a password. However, if you are currently using the Built-in Administrator account as your main account, it will vanish from the Welcome screen as soon as you create another account.

You can add a password to your current account, then set windows to login to that account automatically.

HTH

Jerry
WWarrior's Avatar
WWarrior WWarrior is offline
Junior Member with 11 posts.
 
Join Date: Dec 2008
Location: Sydney
Experience: Einstein
14-Dec-2008, 09:23 AM #5
Quote:
Originally Posted by TheOutcaste View Post
There's the problem. You must have an account with a password to be able to schedule a task, ...
Hi Jerry - That's not exactly correct.

He can execute this vbs script which negates the need for a password login to run a scheduled task.

The code is here:

Code:
Option Explicit

Dim WSHShell, n, MyBox, p, itemtype, Title

Set WSHShell = WScript.CreateObject("WScript.Shell")
p = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\"
p = p & "limitblankpassworduse"
itemtype = "REG_DWORD"
n = 0

WSHShell.RegWrite p, n, itemtype
Title = "Your Scheduled Tasks Can Now be Run without a Password." & vbCR
Title = Title & "You may need to log off/log on" & vbCR
Title = Title & "For the change to take effect."
MyBox = MsgBox(Title,4096,"Finished")
Save that as a vbs file EG: NoPassword.vbs

You can now run scheduled tasks without a password.

kunjikorans - If you like, your batch file could be tweaked to run once only, then stay running, and have a timer / checker built into it which could do the same thing - fire every 15 minutes - it would mean the Dos window remains open all the time but would save the scheduling entries.

You could capture the time and place it into the environment, then read that at set times within the running batch file. A wait commend could be added to make it fire exactly when you wanted. This way, you could kick it off either using scheduler or merely have it in the start up group and run it all the time - only have it execute your commands within the time frame you specify. I have nearly the exact same need and run a similar batch file all the time on my machine using this method. It's very simple to do.
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
scheduled tasks

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑