在 Windows 服务恢复中使用 net start

在 Windows 服务恢复中使用 net start

我正在设置服务恢复,但在使用“运行程序”命令行参数时遇到问题。到目前为止,我尝试过以下方法:

SC failure MSSQL$TEST reset= 2 command= "C:\Windows\System32\cmd.exe net start mssql$test" actions= run/1000/run/1000/run/1000
SC failure MSSQL$TEST reset= 2 command= "C:\Windows\System32\sc.exe sc Start mssql$test" actions= run/1000/run/1000/run/1000
SC failure MSSQL$TEST reset= 2 command= "C:\Windows\System32\cmd.exe sc start MSSQL$test" actions= run/1000/run/1000/run/1000

这些都无法重新启动服务。我设置了所有三次尝试,以防止服务正常重新启动。所有这些命令都可以手动运行CMD,但我无法通过服务恢复选项卡让它们工作。

我正在使用 终止服务,并且我在 Windows 10 Pro x64 上。 任何建议都将不胜感激。taskkill /f /pid ###

答案1

这是 OP。我设法以访客身份发帖,我很抱歉。我还没有尝试添加 /c。那不是只会将命令行参数设置为“/C NET START SERVICENAME”吗?

Scott 关于从 SC 中删除 SC 的回答始于:

 SC failure MSSQL$TEST reset= 2 command= "C:\Windows\System32\sc.exe sc Start mssql$test" actions= run/1000/run/1000/run/1000

解决了这个问题。我相信这是因为它试图从自身内部调用 .exe,从而导致错误。

相关内容