Como controlo o Windows Services a partir de um ficheiro batch?
for example to enable/disable Services
Para desativar o serviço:
sc stop service_name
sc config service_name start= disabled
Para ativar o serviço:
sc config service_name start= auto
sc start service_name
Syntax
SC [\server] [command] [service_name] [Options]
Key
server
- The machine where the service is running
service_name
- The KeyName of the service, this is often but not always the same as the DisplayName shown in Control Panel, Services.You can get the KeyName by running:
SC GetKeyName <DisplayName>
commands:
...
start
START a service.stop
STOP a service
...
config
permanently change the service configuration
Fonte sc .
Leitura Adicional
- Um índice A-Z da linha de comando do Windows CMD - Uma excelente referência para todas as coisas relacionadas à linha do Windows cmd.
- sc - Controle de serviço - Crie, inicie, pare, consulte ou exclua qualquer serviço do Windows.