This topic describes the various options of the SC command with the Create command option. When used with its create command option, you can use it to create a Windows service under which the Endeca Server will run. All rights reserved. This is the name given to the service key in the registry. Note that this name is different from the display name. Note that a space must be used between the binpath parameter and its argument.
You should also use double quotes around the argument.How To Stop Windows 10 From Automatically Downloading & Installing Updates
Note that the option name includes the equal sign, and a space is required between the equal sign and the option value. Use the own parameter value, which means the service runs in its own process. It does not share an executable file with other services. This is the default for the sc create command. Note that other service types are available, but you should use the own value. The SCM makes a list of delayed auto-start services during boot and starts them one at a time after the delay has passed, honoring dependencies.
There is no specific time guarantee as to when the service will be started. To start a disabled service, change the start type to another start value. System startup will continue. This is the default setting. The computer attempts to restart with the last-known-good configuration. This could result in the computer being able to restart, but the service may still be unable to run. If the last-known-good configuration fails, system startup also fails, and the boot process halts with a Stop error.While the useful NET.
EXE utility is great for starting an stopping windows services, it cannot do much beyond that.
Subscribe to RSS
EXE — a versatile command-line utility built into Windows that can help you start, stop, restart or configure any Windows Service. To stop a windows service from an elevated DOS promptrun:. Be sure to enclose the name in quotes if it contains a space! Notice that the SC command will simply make a request for the service to stop and return immediately, before the service has actually stopped.
The NET. Again, the request will be made but SC will not wait for the service to complete its startup before returning. This is very handy information when a service is stuck or unresponsive and must be forcibly terminated!
If you wish to disable a naughty service, preventing anyone from starting it, type:. SC can be used to create a new service as well. Once installed, you can work with the new service as normal in the Services application:. Note that only executables explicitly written to interface with the Windows Service Control Manager should be installed this way.
While SC will happily accept a regular, non-service binary, you will receive the fatal Error when you attempt to start the service.
Employ a service wrapper like AlwaysUp in that situation. Needless to say, please use this command with caution!. Once a service is deleted it cannot be easily re-instated. Removing the wrong service can render your computer unusable! So whenever you need to work with a service via a batch file or from a DOS command prompt, look to SC for support. Hi, great article. I have a Question About use of sc config. I want to Change the user who runs the Service.
I tried already a lot but did not got it working. And be sure to grant the user account the Logon as a service right. Your email address will not be published.
Save my name, email, and website in this browser for the next time I comment.Skip to main content. Tous les produits.
How to create a Windows service by using Sc.exe
To remotely create and start a service from the command line, you can use the SC tool Sc. Although you can use the Netsvc. Note The Srvinstw. More Information. You can use Sc. You can set the parameters to these functions by specifying them on the command line. The tool also lets you specify the name of a remote computer so that you can call the service API functions or view the service status structures on the remote computer.
The advantage to this is that it provides a convenient way to create or configure the service information in the registry and the Service Control Manager database. You do not have to configure the service by manually creating entries in the registry and then restarting the computer to force the Service Control Manager to update its database.
Config Changes the configuration of a service persistent.
Continue Sends a Continue control request to a service. Control Sends a control to a service. Create Creates a service adds it to the registry. Delete Deletes a service from the registry.
EnumDepend Enumerates service dependencies. Interrogate Sends an Interrogate control request to a service. Pause Sends a Pause control request to a service.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up. You will want to restart your service afterwards, which you can do with:.
The answer provided above works great, I can't reply to it, but to add up, in case you need to have quotes or other arguments in the path, say to fix an unquoted path vulnerability in the registry, like an imagepath, you can do the following from CMD as admin:. Hope this helps someone in the future. Sign up to join this community.
The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. How to change path to executable for a Windows Service?
Ask Question. Asked 9 years, 4 months ago. Active 1 year, 8 months ago. Viewed k times. I want to change the path to the executable for a service from the command line. How can I do that? I want to run another. EXE from that service's path to executable. I say Reinstate Monica If Dave's answer is not what you need, then please use the "edit" link to explain a bit more? Active Oldest Votes. If you are moving MySQL config.
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Error The service did not start due to a logon failure. I searched and got the below link Using SC. If he does and you can do the following procedure to check thisjust go to the service Start Menu - type "services", without the quotes.
Find your service on the list, and right-click on it. Select "Properties", and go to the "Log On" tab. Retype the "Password" and "Confirm password".
Click OK. Just try to start the service again, and it will work. On the right panel, right-click on "Log on as a service", and select "Properties". Click on "Add User or Group" and add your user. You might have to reboot your machine. Open a command prompt and type:.
After your user has been granted the Log On As A Service right, you can create and start services through the command line. Probably the issue is that it doesn't want quotes around the password. Same goes for the username. Alternatively it may be because the given account has not been granted the "log on as a service" privilege.
SC Create command syntax
The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. My reading of the sc. It is advisable to specify a Display Name for the service as well as setting the start setting to auto so that it starts automatically.
Parameters for created services have some peculiar formating issues, in particular if the command includes spaces or quotes:. If you want to enter command line parameters for the service, you have to enclose the whole command line in quotes.
If the path to the executable contains spacesyou have to enclose the path in quotes. So for a command that has both parameters and a path with spaces, you need nested quotes.
The same holds if the parameters themselves contain quotes, you will need to escape those too. Despite using backslashes as escape characters, you do not have to escape the regular backslashes contained in the path.
How to: register service with SC command without losing quotes in binpath value
This is contrary to how you normally use backslashes as escape characters. See here: Modifying the "Path to executable" of a windows service. I had issues getting this to work on Windows 7. It also important taking in account how you access the Arguments in the code of the application. But I couldn't access the arguments through the args variable when I run it as a service.
Instead it suggests placing your logic in the OnStart method and then using C Environment. GetCommandLineArgs. I couldn't handle the issue with your proposals, at the end with the x86 folder it only worked in power shell windows server using environment variables:.Modifies the value of a service's entries in the registry and in the Service Control Manager database. For examples of how to use this command, see Examples. You may also leave feedback directly on GitHub.
Skip to main content. Exit focus mode. To run SC. It does not share an executable file with other services. This is the default value. It shares an executable file with other services. Interactive services must be run under the LocalSystem account. To start a disabled service, change the start type to some other value. Startup will continue. This is the default setting.
The computer attempts to restart with the last-known good configuration.
This could result in the computer being able to restart, but the service may still be unable to run. If the last-known good configuration fails, startup also fails, and the boot process halts with a Stop error.
No notification is given to the user beyond recording the error in the Event Log. The default value is null. Tags are used only for boot-start and system-start drivers. The default setting is LocalSystem. For example, the subkey name of one particular service is wuauservwhich has a more friendly display name of Automatic Updates.
This is required if an account other than the LocalSystem account is used. Displays help at the command prompt. Remarks For each command-line option parameterthe equal sign is part of the option name. If the space is omitted, the operation will fail.
Yes No. Any additional feedback?