Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Install a perl script as a Win NT/2000/XP service.

by marmanold (Novice)
on Jun 26, 2011 at 03:52 UTC ( #911431=note: print w/ replies, xml ) Need Help??


in reply to Install a perl script as a Win NT/2000/XP service.

None of the above worked for me on Windows 7 64-bit, but they did lead me in the right direction. The Non-Sucking Service Manager ended up being the key. Below is the code for the two .bat scripts needed to install a Perl script as a service in Windows 7 64-bit. It should also work in 32-bit versions, but I have not been able to test this yet.

install_service.bat

@echo off if defined %ProgramFiles(x86)% ( "%ProgramFiles(x86)%\path_to\your_app\service\nssm.exe" install my +Service "C:\Program Files (x86)\path_to\your_app\portable_perl\perl\b +in\perl.exe" """C:\Program Files (x86)\path_to\your_app\myService.pl" +"" ) else ( "%ProgramFiles%\path_to\your_app\service\nssm.exe" install myServi +ce "C:\Program Files\path_to\your_app\portable_perl\perl\bin\perl.exe +" """C:\Program Files\path_to\your_app\myService.pl""" ) net start myService exit

remove_service.bat

@echo off net stop myService if defined %ProgramFiles(x86)% ( "%ProgramFiles(x86)%\path_to\your_app\service\nssm.exe" remove myS +ervice confirm ) else ( "%ProgramFiles%\path_to\your_app\service\nssm.exe" remove myServic +e confirm ) exit


Comment on Re: Install a perl script as a Win NT/2000/XP service.
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://911431]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (13)
As of 2015-07-28 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls