Sign in to follow this  
Followers 0
Olish

The simplest way to craete a service...

4 posts in this topic

#1 ·  Posted (edited)

Hello everybody !

I'd like to register my EXE as a Windows Service as simply as possible. Can someone tell me how could I do please ?

Thank you for your help.

Olivier, from France.

PS : Sorry for the title > "create"

Edited by Olish

Olivier, from France.Free Wake On LAN script

Share this post


Link to post
Share on other sites



HI,

maybe this helps out. :D Never tested! :wacko:

Func _SrvAny($service, $fullpath, $hidden = 0)
; Adds a program, as a windows service.
; Requires $instsrv and $srvany to be assigned, full paths.
; e.g. _SrvAny ( 'ServiceName', 'FullPath_to_the_program' )
    Local $instsrv = @WindowsDir & '\System32\Instsrv.exe'
    Local $srvany = @WindowsDir & '\System32\SrvAny.exe'
    If FileExists($instsrv) And FileExists($srvany) Then
        RunWait($instsrv & ' ' & $service & ' "' & $srvany & '"', '', @SW_HIDE)
        Local $key = 'HKLM\SYSTEM\CurrentControlSet\Services\' & $service
        If RegRead($key, 'DisplayName') Then
            If $hidden Then RegWrite($key & '\Parameters', 'AppParameters', 'Reg_sz', '/hidden')
            Return RegWrite($key & '\Parameters', 'Application', 'Reg_sz', $fullpath)
        EndIf
    EndIf
EndFunc

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thank you for your help th.meger .

And for unregistering the service, may I delete corresponding registry keys ?


Olivier, from France.Free Wake On LAN script

Share this post


Link to post
Share on other sites

Thank you for your help th.meger .

And for unregistering the service, may I delete corresponding registry keys ?

Just use SC delete "servicename"

:D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0