ScoobyNet.com - Subaru Enthusiast Forum

ScoobyNet.com - Subaru Enthusiast Forum (https://www.scoobynet.com/)
-   Computer & Technology Related (https://www.scoobynet.com/computer-and-technology-related-34/)
-   -   starting as a windows service (https://www.scoobynet.com/computer-and-technology-related-34/210462-starting-as-a-windows-service.html)

djuk 18 May 2003 05:28 PM

I have a command line (its an ip-tunnel application) which i currently run on one of my machines at startup which is fine but its currently run from a batch file and sits on the task bar all the time which is a bit messy and vunerable to being shut down accidently. Is there any way to execute this command line on startup as a service or otherwise hidden?


David_Wallis 18 May 2003 06:22 PM

theres a utility in the resource kit.. bit.. apps shouldnt really be run as services.. mail me if you cant find it..

David

ozzy 18 May 2003 06:33 PM

You need the files instsrv.exe and srvany.exe to install and run the utility as a service. Copy both to your %systemroot%\System32\ folder i.e. c:\winnt\system32 OR c:\windows\system32 (if XP)

The install command from a batch file would be:-

%systemroot%\system32\instsrv servicename %systemroot%\system32\srvany.exe

This will create a servive entry under HKLM\system\currentcontrolset\services\

You'll need to create a Paramter key under the new service with the following string values:-

AppDirectory
Application

The value of AppDirectory would be the folder holding the application executable and the Application value would hold the name and full path to the .exe file.

e.g. AppDirectory = "C:\appfolder" & Application = "C:\appfolder\app.exe"

I use a batch file to install the seti client as a service, so I mail you my install script for an idea of how it's done.

Stefan

ozzy 18 May 2003 06:36 PM

OK, I would e-mail you if you had an e-mail address in your profile.

Here's the batch script:-

rem
rem create Seti directory
rem
mkdir %systemroot%\System32\SAH
%systemroot%\System32\Attrib +h %systemroot%\System32\SAH
rem
rem copy files
rem
copy instsrv.exe %systemroot%\System32\instsrv.exe
copy srvany.exe %systemroot%\System32\srvany.exe
copy SAH.exe %systemroot%\System32\SAH\SAH.exe
copy user_info.sah %systemroot%\System32\SAH\user_info.sah
copy setiwatch.exe %systemroot%\System32\SAH\setiwatch.exe
rem
rem Create new services
rem
%systemroot%\System32\instsrv SAH %systemroot%\System32\srvany.exe


And here's the registry (.reg) file needed for the new service:-

REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SAH]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):25,53,79,73,74,65,6d,52,6f,6f,7 4,25,5c,53,79,73,74,65,6d,33,\
32,5c,53,52,56,41,4e,59,2e,45,58,45,00
"DisplayName"="SAH"
"ObjectName"="LocalSystem"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\SAH\Parameters]
"AppDirectory"="C:\\WINNT\\System32\\SAH\\"
"Application"="C:\\WINNT\\System32\\SAH\\sah.e xe"
"AppParameters"=""


If you need the two files, e-mail me and I'll send you them.

Stefan


All times are GMT +1. The time now is 11:29 AM.


© 2024 MH Sub I, LLC dba Internet Brands