9.5.6 ServiceStop (stop a service)
- Purpose
-
Stops a service.
- Syntax
ServiceStop(ServiceInfoName)
- Argument
-
- ServiceInfoName
-
Specify the service information name of the service to be stopped. Write a character string or a variable that stores this value.
- Description
-
The ServiceStop command stops an active service, using the value stored in the keyword Name in the service information.
The execution result is stored in the _SVC_RTN_ reserved variable. The command returns True on successful execution, or False for all other states.
- Note
-
Execute the script file as a user who has administrator permissions. For details, see 1.8.2 Command behavior.
- Important note
-
Do not execute this command for services that cannot be stopped. This command issues a stop request to the specified service, and will not terminate until the specified service stops.
- Example
' Stop the active JP1/Script service. Dim svStatus ServiceSetValue("JSService", Name::"JP1_Script") ServiceRefer("JSService", svStatus) If svStatus = SERVICE_RUNNING Then ServiceStop("JSService") End
- JP1/Script version
-
Supported from JP1/Script 01-00.