Running a LabVIEW executable as a Windows service


These steps will allow you to set up an executable built with LabVIEW as a Windows service, allowing it to start up automatically and run in the background.

Note that this is not a full-featured solution to creating a service, for example your LabVIEW program will not receive shutdown or restart messages which would allow it to release its resources gracefully. If you don’t require this sort of control though, this is a simple solution that doesn’t require any 3rd party dependencies

1. Download the Windows 2003 Resource Kit and install it.  By default it will be placed in the Program Files directory

The Resource Kit includes SrvAny.exe, which allows any executable to be run as a service. Microsoft’s knowledgebase article on using SrvAny.exe can be found here, but the short version is;

2. Run the following from the command line – use this if you are running 32 bit Windows

instsrv "My LabVIEW Service" "C:\Program Files\Windows Resource Kits\Tools\srvany.exe"

or this for 64 bit

instsrv "My LabVIEW Service" "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe"

Don’t forget to change “My LabVIEW Service” to the name of your service

3. Copy this into a text file and save it with a .reg extension.  This will let Windows insert the required entries in the registry when you double-click the file, so you don’t have to edit the registry directly

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\My LabVIEW Service]
"Description"="This is My LabVIEW Service"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\My LabVIEW Service\Parameters]
"Application"="C:\Program Files\My LabVIEW Service\My LabVIEW Service.exe"


Again, you will need to change ‘My LabVIEW Service’ to suit your service’s name and executable location

Double-click the .reg file, and your service will be installed and should start automatically. You can check on the service in Services control panel in Administrative Tools


Subscribe to our newsletter

Did you find this post helpful? Sign up to the Lonely Ant newsletter to get more useful tips delivered directly to your mailbox

Unsubscribe at any time. I will not share your information with third parties.

* indicates required