SYNOPSIS
mksrv
mksrv
mksrv
mksrv
mksrv
mksrv
DESCRIPTION
The mksrv utility lets you run any program or script as a service.
To set up a program or script to run as a service, you must first use
mksrv with the
By default, when no
When specifying the command_line to be cached, you may need to quote the arguments passed at the end of the command line using normal quoting rules for the shell in use. For example:
mksrv -install -name MyService -displayname "My Service" -desktop "sh -c 'cd/tmp;ls'"
Once a service has been set up by the svsh utility, it can be started and stopped as desired with the MKS Toolkit control panel applet or with the service utility by referring to it using either the service or display name.
When a mksrv-created service is stopped (for example, with the service stop command), the child process for the service itself is killed, but any children created by that process are not.
Options
-debug -
Runs the service in debugging mode. In debugging mode, the service is run with a console window that lets you interact with it.
-desktop -
Tells the Windows Service Control Manager to let the service interact with the desktop through a console window. This option cannot be used with the
-username option; only the local system account may interact with the desktop. -displayname displayname-
Specifies the display name for the service being set up.
-install -
Sets up a program or script to be run as a service (see the DESCRIPTION section).
-list -
Displays the service names of all services registered using mksrv,
-name service_name-name service_or_display_name-
When used with
-install , it specifies the service name to be used for the service being set up.When used with
-debug or-remove , it specifies either the service name or the display name of an already existing mksrv-created service. -password password-
Can only be used with
-username option to specify the password for the username account. -quiet -
Directs status and error messages to the standard output, which is normally not visible unless redirected.
-remove -
Removes a mksrv-created service from the roster of services registered with the Service Control Manager.
-RemoveAll -
Removes all services registered using mksrv,
-username username-
Specifies the username whose account is to be used to run the service. username should also include the domain name when appropriate. You can specify the password associated with this account with the
-password option. When no-password option is specified, mksrv prompts you to enter the associated password. -verbose -
Displays a status window even if no error occurs.
EXAMPLES
The following commands set up the login version of the default shell to run as a service and start it:
mksrv -install -displayname "Shell as LocalSystem" -desktop $SHELL -L service start "Shell as LocalSystem"
A new console window appears that is running using the local system account. The whoami utility can confirm this.
DIAGNOSTICS
Possible exit status values are:
PORTABILITY
Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
AVAILABILITY
PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
- Commands:
- service
PTC MKS Toolkit 10.5 Documentation Build 40.