banner



How To Start A Service In Windows

If you lot're like most Windows users, you have lots of smashing little utilities that run when yous start Windows. While this works great for virtually apps, there are some that would be nice to showtime even earlier a user logs in to the PC. To do this, yous'll demand to run the app equally a Windows service.

Windows services are a special form of programs that are configured to launch and run in the groundwork, usually without any sort of user interface and without needing a user to log in to the PC. Many gamers and power users know them equally those things you lot used to disable to help speed up your system, though that's really non necessary any more than.

The primary advantage of running an app every bit a service is that you can have a program start earlier a user to log in. That can be particularly important with apps that provide of import services you want to be bachelor when y'all're away from your figurer.

RELATED: Understanding and Managing Windows Services

A perfect example of this is Plex, a media server app that can stream local content to just near any device you own. Sure, you could permit it sit down in the system tray like a normal programme, but what if the computer restarts due to a power outage or scheduled updates? Until yous log dorsum in on the PC, Plex wouldn't be available. That's irritating if you have to run to another room to start Plex back up while your popcorn gets common cold, and super irritating if you're out of town and trying to stream your media over the Cyberspace. Setting up Plex equally a Service would solve that problem.

Before getting started, yous should exist aware of a couple of of import caveats to running an app as a service:

  • The app will non put an icon in the system tray. If yous need the interface available regularly for an app, it may not be all-time suited to run equally a service.
  • When you need to make configuration changes or updates, you lot'll need to cease the service, run the programme equally a regular app, practice what yous demand to practice, terminate the program, and and then start the service over again.
  • If the program is already prepare up to run when Windows starts, you'll demand to disable that so that you don't end up with two instances running. About programs have an option in the interface for toggling this setting. Others may add themselves to your Startup folder, so y'all can remove them there.

Prepare to roll? Let'south talk about how to fix information technology up.

Step One: Install SrvStart

To run an app as a service, you lot're going to need a small, third-political party utility. There are several out there, only our favorite is SrvStart. It was originally designed for Windows NT, and will work with just about whatever version of Windows from Windows XP on up.

To get started, head over to the SrvStart download page and take hold of the utility. The download contains just 4 files (two DLL and ii EXE files). In that location'due south no installer; instead, copy these to your computer'southward C:\Windows binder these to your main Windows folder to "install" SrvStart.

Nosotros're likewise going to assume that you've already installed and set up whatever plan you're going to plough into a service, but if you haven't, now would be a expert time to practice that too.

Step Two: Create a Configuration File for the New Service

Next, y'all'll want to create a configuration file that SrvStart volition read to create the service. At that place'southward a lot yous tin exercise with SrvStart, and you lot can read the full details on all the configuration options on the documentation folio. For this example, we are but going to use two commands: startup, which specifies the program to launch, and shutdown_method, which tells SrvStart how to shut the programme when the corresponding service is stopped.

Burn up Notepad and create your configuration file using the format below. Here, we're using Plex, simply you lot tin can create a file for any program you lot want to run every bit a service. The startup control simply specifies the path where the executable file resides. For the shutdown_method control, we're using the winmessage parameter, which causes SrvStart to transport a Windows close bulletin to any windows opened past the service.

[Plex] startup="C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" shutdown_method=winmessage

Apparently, adjust the path and name according to the plan you're launching.

Save the new configuration file wherever you like, and supercede the .txt extension with a .ini extension. Brand note of the file proper noun, since nosotros'll need information technology in the adjacent step. For ease of typing at the Command Prompt, we propose saving this file temporarily correct on your C: drive.

Stride Iii: Use the Control Prompt to Create the New Service

Your adjacent pace is using the Windows Service Controller (SC) command to create the new service based on the criteria in your configuration file. Open Command Prompt by right-clicking the Beginning menu (or pressing Windows+X), choosing "Command Prompt (Admin)", and then clicking Yes to allow it to run with administrative privileges.

At the Control Prompt, utilize the post-obit syntax to create the new service:

SC CREATE <servicename> Displayname= "<servicename>" binpath= "srvstart.exe <servicename> -c <path to srvstart config file>" first= <starttype>

At that place are a couple of things to note in that control. First, each equal sign (=) has a space after information technology. That's required. Also, the <servicename> value is entirely up to you. And, finally, for the <starttype> value, you'll want to use auto and then that the service starts automatically with Windows.

So in our Plex case, the command would look like this:

SC CREATE Plex Displayname= "Plex" binpath= "srvstart.exe Plex -c C:PlexService.ini" commencement= auto

Aye, yous read that right: I used C:PlexService.ini instead of C:\PlexService.ini . The command requires you to remove the slash.

When you run the command, you should receive a SUCCESS message if everything goes well.

From this point on, your new service will run whenever Windows starts. If you open the Windows Services interface (just click Start and type "Services"), you can find and configure the new service just like you would any other.

And that's all there is to information technology. If you have apps that get-go with Windows and yous'd rather they start without needing a user to log in, it's easy enough to turn whatever app into a service. We've only but touched on the basic method for creating and running a new service, but there's a lot more than you can do with SrvStart to fine tune how a service runs. Be certain to check out the documentation if you'd like to larn more.

Source: https://www.howtogeek.com/50786/using-srvstart-to-run-any-application-as-a-windows-service/

Posted by: kruegerbittly.blogspot.com

0 Response to "How To Start A Service In Windows"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel