Bookmarks: | Page Index | Recent Changes | Recently Commented | Users | Registration |
The basic syntax for winserv invocation is the following:
One notable exception to this rule is the help subcommand that doesn't need any arguments (and ignores them, if any). Some subcommands (showconfig, status) accept more than one service name.
creates a service that runs command (any executable) when started and stops when the program exits. Command-line parameters for the command may also be specified.
modifies various parameters for the service in SCM and registry databases. If the program is specified, it is stored in registry as a new program to be started by this winserv-based service.
marks a service for deletion. When it is stopped and all its handles are closed, the service is removed from the SCM database.
shows the current service's parameters that may be modified with the configure subcommand. Some parameters make sense only for winserv-based services, and they will not be shown for other services (see parameters description below).
These subcommands send control signals to the running service. -nowait option means that the utility shouldn't wait until the service will report an appropriate status for the request (stopped for stop, paused for pause, running for continue).
Starts the service using the given command-line arguments. If the service is winserv-based, the arguments are stored in the Service Args? environment variable.
Restarts the service, i.e. stops it, waits for it to be stopped, and then starts it with the arguments given.
Prints out the current status of the services, one of: RUNNING, STOPPED, PAUSED, START_PENDING, PAUSE_PENDING, CONTINUE_PENDING, STOP_PENDING. The program's output is formatted like this:
You see that the program prints the list of SCM control signals that the service can accept now.
Using install and configure subcommands, you can specify parameters for the newly-created or configured service. Some of the service options require an argument. Here is the list of supported service options with arguments:
Winserv will refuse to set binary pathname and some winserv-specific options for non-winserv based services. Use -forceforeign option to suppress this behavior.
Use -expand option to store the application's command-line in registry as a REG_EXPAND_SZ type of value. In this case, all references to environment variables will be auto-expanded before starting the application:
Note that you have to use -expand with %ServiceArgs% to pass the service's command-line parameters as extra arguments.