Windows server 2003: criar serviço
Os programas podem ser criados como serviços no Windows Server 2003, para serem executados permanentemente e sempre que o sistema for iniciado. Isso funciona mesmo sem que um usuário esteja conectado. Você pode ler sobre como configurar um aplicativo nesta dica prática.
Windows Server 2003: Crie um serviço usando as Ferramentas do Resource Kit
É relativamente fácil com as Ferramentas do Kit de Recursos do Windows Server 2003, que você pode baixar aqui em CHIP: Download das Ferramentas do Kit de Recursos.
- Instale as ferramentas do kit e, claro, o programa a ser configurado como um serviço. Anote o caminho completo para o arquivo * .exe do programa.
- Inicie a linha de comando (CMD) na pasta de instalação do Kit Tools. Digite o seguinte comando: instsrv.exe [nome do serviço] [caminho para o aplicativo] \ srvany.exe, por exemplo instsrv.exe MeinDienst C: \ Program \ MeinDienst.exe \ srvany.exe e conclua com "Enter",
- Com "Windows" + "R", abra a janela de execução, digite regedit.exe e clique em Ok. Agora, procure a chave no registro: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ [nome do seu serviço]. Agora crie uma nova subchave chamada "Parâmetros". Atribua a esse valor: Nome: Aplicativo Tipo de dados: String (REG_SZ) Valor: [Caminho para * .exe] Agora feche o editor do Registro.
- O serviço agora é criado e inicia automaticamente. Para fazer alterações, abra o Painel de Controle, "Ferramentas Administrativas" e, finalmente, "Serviços". Lá, você também encontrará o serviço que criou, pelo qual poderá fazer as configurações.
Ferramenta poderosa: SC.exe para diversas configurações de serviço
Com este programa, que você também pode atualizar através das Ferramentas do Windows Server 2003 Resource Kit, você pode criar, editar e excluir serviços completamente através da linha de comando. Funciona assim.
- Abra a linha de comando novamente iniciando Executar ("Windows" + "R") cmd.exe.
- Crie o serviço: sc crie "MeinDienst" start = auto binpath = "C: \ Program \ MeinDienst.exe"
- Configure um serviço para que não seja iniciado automaticamente: sc config "My service" start = disabled
- Altere a descrição do serviço: sc description "MeinDienst" "Este programa é iniciado como um serviço e está sempre ativo."
Em geral, preste atenção aos espaços, pois eles levam a dificuldades, principalmente ao especificar o caminho. Se possível, evite-os completamente nos nomes. Se você não quiser trabalhar com a linha de comando, dê uma olhada em uma das nossas alternativas de console do Windows.