General discussion

Locked

Creating a service to run a batch file?

By csu_tech ·
Is it possible to make a service that will run a batch file? I need a batch file to run before anyone has logged in to the server so we don't need to leave someone logged in all the time while the batch file is running and so it will automatically run if the server is restarted.

csu_tech@yahoo.com

This conversation is currently closed to new comments.

3 total posts (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Comments

Collapse -

Creating a service to run a batch file?

by strong002 In reply to Creating a service to run ...

On the NT Resource Kit 4.0 CD there is a file called instsrv.exe. this will make a cmd or bat file into a service then you can give it an account in service manager. The command line is as follows:
instsrv <service name> <drive><folder name>\<filename>.cmd

Collapse -

Creating a service to run a batch file?

by madsg In reply to Creating a service to run ...

You can use the AT command from the dos command like thes:

At
Lists scheduled commands or 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

Parameters

none

Used without parameters, at lists scheduled commands.

\\computername

Specifies a remote computer. If this parameter is omitted, the commands are scheduled on the local computer.

id

Specifie the identification number assigned to a scheduled command.

/delete

Cancels a scheduled command. If id is omitted, all the scheduledcommands on the computer are canceled.

/yes

Forces a yes answer to all queries from the system when deleting scheduled events.

time

Specifies the time when the command is to run. Time is expressed as hours:minutes in 24-hour notation (00:00 [midnight] through 23:59).

/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 every specified day or days of the week or month (for example,every Thursday, or the third day of every month). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas. 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). Specify date as one or more days of the week (M,T,W,Th,F,S,Su) or one or more days of the month (using numbers 1 through 31). Separate multiple date entries with commas

Specifies the Windows NT command, program (.exe or .com file), or batch program (.bat or .cmd file) to be run.

Collapse -

Creating a service to run a batch file?

by csu_tech In reply to Creating a service to run ...

Thanks for the help but I want to
create an actual service for my batch
file instead of relying on the AT
command to run and follw a
schedule. The goal is to have this
batch file turned into a service so it is
running whenever the computer is.

Back to Windows Forum
3 total posts (Page 1 of 1)  

Related Discussions

Related Forums