Schedule a batch file

T

Tom

I'd like to schedule a batch file to stop a service at a specific time
(backup time) and start it afterwards.
I can use the scheduler to do this but I don't know which app to use. I'm
assuming it's the DOS prompt (cmd.exe) but I don't know the syntax.

Can anyone help with this?

Thanks,
t
 
W

William Hutchison [MSFT]

Tom,

You can use the built-in AT command to schedule a batch job from the
command-line. If you type, "at -?" at the command-line, you will get the
syntax for the command like so:

at -?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on
the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of the
day (for example, next Thursday). If date is omitted,
the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.


William Hutchison [MSFT]
 
T

Tom

Thanks William. I decided to use the netsvc command to remotely stop the
services.

However, I've copied your suggestion into my 'database' for future
reference...good stuff!

Thanks


William Hutchison said:
Tom,

You can use the built-in AT command to schedule a batch job from the
command-line. If you type, "at -?" at the command-line, you will get the
syntax for the command like so:

at -?
The AT command schedules commands and programs to run on a computer at
a specified time and date. The Schedule service must be running to use
the AT command.

AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
AT [\\computername] time [/INTERACTIVE]
[ /EVERY:date[,...] | /NEXT:date[,...]] "command"

\\computername Specifies a remote computer. Commands are scheduled on
the
local computer if this parameter is omitted.
id Is an identification number assigned to a scheduled
command.
/delete Cancels a scheduled command. If id is omitted, all the
scheduled commands on the computer are canceled.
/yes Used with cancel all jobs command when no further
confirmation is desired.
time Specifies the time when command is to run.
/interactive Allows the job to interact with the desktop of the user
who is logged on at the time the job runs.
/every:date[,...] Runs the command on each specified day(s) of the week
or
month. If date is omitted, the current day of the month
is assumed.
/next:date[,...] Runs the specified command on the next occurrence of
the
day (for example, next Thursday). If date is omitted,
the
current day of the month is assumed.
"command" Is the Windows NT command, or batch program to be run.


William Hutchison [MSFT]
--
This posting is provided "AS IS" with no warranties, and confers no
rights.

Tom said:
I'd like to schedule a batch file to stop a service at a specific time
(backup time) and start it afterwards.
I can use the scheduler to do this but I don't know which app to use.
I'm assuming it's the DOS prompt (cmd.exe) but I don't know the syntax.

Can anyone help with this?

Thanks,
t
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top