Installing service with automatic startup from command prompt

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to install a Windows service from the command prompt and at
the same time set the "Startup type" to automatic?
 
aaa said:
Is there a way to install a Windows service from the command prompt

C:\>%SystemRoot%\system32\sc.exe create /?
Creates a service entry in the registry and Service Database.
SYNTAX:
sc create [service name] [binPath= ] <option1> <option2>...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
type= <own|share|interact|kernel|filesys|rec>
(default = own)
start= <boot|system|auto|demand|disabled>
(default = demand)
error= <normal|severe|critical|ignore>
(default = normal)
binPath= <BinaryPathName>
group= <LoadOrderGroup>
tag= <yes|no>
depend= <Dependencies(separated by / (forward slash))>
obj= <AccountName|ObjectName>
(default = LocalSystem)
DisplayName= <display name>
and at
the same time set the "Startup type" to automatic?

Setting the Messenger service to automatic:

%SystemRoot%\system32\sc.exe config Messenger start= auto
 
From: "aaa" <[email protected]>

| Is there a way to install a Windows service from the command prompt and at
| the same time set the "Startup type" to automatic?

You would need the Resource Kit utility; INSTSRV.EXE

And run it such as; instsrv MyServiceName MyServiceEXE_path

Then you can use the SC command such as...

sc config MyServiceName start= auto

You would have to read the instructions on how to properly use the INSTSRV.EXE utility.

I used this process to create a Seti@Home service to run the SETI Command Line version.

InstallSeti.BAT
----------------------
@echo off
copy ".\SaH\*.*" %windir% >nul
%windir%\instsrv MySeti %windir%\srvany.exe
regedit /s .\sah_servXP.reg
sc config MySeti start= auto
c:
cd %windir%
cmd



sah_servXP.reg
--------------------------------

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySeti]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MySeti\Parameters]
"Application"="c:\\windows\\MySeti.exe"
"AppDirectory"="c:\\windows"
 
From: "Torgeir Bakken (MVP)" <[email protected]>

| aaa wrote:
||
| C:\>%SystemRoot%\system32\sc.exe create /?
| Creates a service entry in the registry and Service Database.
| SYNTAX:
| sc create [service name] [binPath= ] <option1> <option2>...

< snip>

Well that's much better than using INSTSRV.EXE and SRVANY.EXE ! :-)
 
Back
Top