由Tanuki软件作为Windows服务使用命令行重新启动wrapper.exe

问题描述:

有谁知道如何重新启动此服务,而无需通过services.msc手动触发它?我怎样才能把它放在一个脚本中,这个服务可以作为服务自动重启?提前致谢!由Tanuki软件作为Windows服务使用命令行重新启动wrapper.exe

"c:\Program Files (x86)\Tanuki\bin\wrapper.exe" -s "c:\Program Files (x86)\Tanuki\conf\MTG.conf" 

我收到此错误信息:

C:\Users\Ning>"c:\Program Files (x86)\Tanuki\bin\wrapper.exe" -s "c:\Program Files (x86)\Tanuki\conf\MTG.conf" 
Attempting to start MTG as an NT service. 

Calling StartServiceCtrlDispatcher...please wait. 

StartServiceControlDispatcher failed! 

The -s and --service commands should only be called by the Windows 
ServiceManager to control the Wrapper as a service, and is not 
designed to be run manually by the user. 

For help, type 
c:\Program Files (x86)\Tanuki\bin\wrapper -?} 

试试这个(运行脚本为管理员):

启动服务:

RunWait, %comspec% /c "net start service_name",, Hide 

停止服务:

RunWait, %comspec% /c "net stop service_name",, Hide 

将“service_name”替换为要重新启动的服务名称。 确保您使用的是该服务的属性(不是显示名称)中显示的正确服务名称 。

+0

我该如何把这整件事放在那里? (x86)\ Tanuki \ bin \ wrapper.exe“-s”c:\ Program Files(x86)\ Tanuki \ conf \ MTG.conf“ 我还在使用wrapper.exe它使用来自MTG.conf的配置 –

+0

以上代码适用于Autohotkey脚本。尝试将代码复制到AHK脚本中并以管理员身份运行(使用上下文菜单)。 – user3419297

+0

谢谢大家,它确实启动了服务,但我想在services.mcs或Service Management Console中以“运行”状态查看它。那会怎么样? –