LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

wine-sc

Create, query, and control Windows services in a Wine prefix

TLDR

Query the status of a service
$ wine sc query [service_name]
copy
Create a service from an executable (space after binpath= is conventional)
$ wine sc create [service_name] binpath= '[C:\path\to\service.exe]'
copy
Start or stop a service
$ wine sc start [service_name]
copy
Set the description of a service
$ wine sc description [service_name] '[description text]'
copy
Delete a service
$ wine sc delete [service_name]
copy
Display usage
$ wine sc /?
copy

SYNOPSIS

wine sc command servicename [parameter= value ...]

DESCRIPTION

wine sc is Wine's reimplementation of the Windows sc.exe service-control tool. It talks to the Service Control Manager in the current Wine prefix to create, query, start, stop, describe, and delete services.Create/config parameters use the Windows name= value form. A space after the equals sign is the documented Windows syntax (binpath= C:\foo.exe); current Wine also accepts binpath=C:\foo.exe with no space.The tool operates on the prefix named by WINEPREFIX (default ~/.wine). It is the counterpart of wine net, which only starts, stops, and lists running services. Remote-server syntax (\\\\server) is not implemented.

PARAMETERS

query service

Print type, state, and exit codes for the named service.
create service binpath= path [options]
Create a service. binpath= is required. Optional create keys: displayname=, type= (own, share, kernel, filesys, rec, interact), start= (boot, system, auto, demand, disabled), error= (normal, severe, critical, ignore), group=, depend=, obj=, password=.
start service [args...]
Start the service, then print its status. Extra arguments are passed to the service.
stop service
Stop the service, then print its status.
description service [text]
Set (or clear) the service description.
failure service [reset= n] [reboot= msg] [command= cmd] [actions= list]
Set failure actions.
delete service
Remove the service from the service database.

INSTALL

sudo dnf install wine
copy
sudo pacman -S wine
copy
sudo apk add wine
copy
sudo zypper install wine
copy
nix profile install nixpkgs#wine
copy

CAVEATS

Wine implements a subset of Windows sc: create, query, start, stop, delete, description, and failure. Other Windows verbs (config, qc, sdshow, ...) are not available. Creating a service only writes a database entry; the binpath= executable must actually exist in the prefix or start will fail. If the service is running, delete marks it for deletion until it stops.

HISTORY

Wine's sc.exe was added in 2010 by Hans Leidekker so Windows installers that register services through sc can run under Wine. Parsing of name=value (no space) was fixed in 2022.

SEE ALSO

wine(1), wine-net(1), wineserver(1), wineboot(1)

RESOURCES

Copied to clipboard
Kai