Using Services.exe from the Command Line

I would like to modify a service written in VB.Net to use command line arguments. I have no problem using the GetCommandLineArgs function; my problem is - how do I define a command line argument for a service.

Any help would be much appreciated.

Tim Carmichael

[279 byte] By [T.Carmichael] at [2007-12-28]
# 1

T.Carmichael,

You can use service.exe to control a service from the command line. The following table shows the commands that can be used for most services:

load <service name>

Activates a service that is inactive.

list

Lists all services available on the device.

start <service instance>

Starts a specific service.

stop <service instance>

Stops a specific service.

refresh <service instance>

Causes a service to refresh its configuration parameters.

unload <service instance>

Causes a service to be unloaded and removed.

register <service name>

Causes a service to be automatically loaded on the next device reboot.

unregister <service name>

A service will not be automatically loaded on the next device reboot.

command <service name> [arg1 arg2 ...]

Sends service-specific command(s) to a service.

help <service name>

Displays information about which service-specific commands are supported.

Note: <service instance> stands for the instantiation of a service, e.g., HTP0. <servie name> stands for the service's name as it is displayed in the protected registry, e.g., HTTPD.
To control a Telnet server using Services.exe, type the following syntax at a command prompt:

s -d list
s services -d start tel0:
s services -d stop tel0:
s services -d refresh tel0:
The above commands will list all the available services on your device. Services.exe will start the Telnet server, then stop it, and then refresh its configuration parameters.

Adding the "-d" flag will generate a debug output, instead of console output.

BrunoYu-MSFT at 2007-9-4 > top of Msdn Tech,Visual Basic,Visual Basic General...