I needed this stuff a couple of times but never took the time to document it properly.. Summarized: Use a binary from Microsofts Resource Kit as a called to perl. KB article here.
Copy the executable files to the system path (or wherever you see fit within the path)
copy INSTSRV.EXE C:\Windows\System32
copy SRVANY.EXE C:\Windows\System32
Create a service called
SERVICENAME and point it to SRVANY.EXE that you copied to the system directory.
INSTSRV.EXE SERVICENAME C:\Windows\System32\SRVANY.EXE
Open the Registry Editor (regedit) and look for
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SERVICENAME
Right click on the
SERVICENAME in the left column and add a new string value named
Description. Double-click on
Description and set the value to
SERVICENAME DESCRIPTION.
Right click on the
SERVICENAME in the left column and add a new key named
Parameters. Click on
Parameters and add a new String Value called
Application. Double-click on
Application and set the value to
C:\Perl\bin\perl.exe "SCRIPTLOCATION"
Close the Registry Editor.
The service show now show up in your Services panel in the
Control Panel > Administrative Tools. Change the startup mode from Manual to Automatic if needed.
SERVICENAME is whatever you want your service to be called, SERVICENAME DESCRIPTION is whatever you want listed as a description for this service and SCRIPTLOCATION is the path to your script.