Stop and Start a service via batch or cmd file?

2020-01-23 10:11发布

How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?

15条回答
Explosion°爆炸
2楼-- · 2020-01-23 11:02

or you can start remote service with this cmd : sc \\<computer> start <service>

查看更多
Bombasti
3楼-- · 2020-01-23 11:05

SC can do everything with services... start, stop, check, configure, and more...

查看更多
迷人小祖宗
4楼-- · 2020-01-23 11:07

Here is the Windows 10 command to start System Restore using batch :

sc config swprv start= Auto

You may also like those commands :

  • Change registry value to auto start System restore

    REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SystemRestore" /v DisableSR /t REG_DWORD /d 0 /f

  • Create a system restore point

    Wmic.exe /Namespace:\root\default Path SystemRestore Call CreateRestorePoint "djibe saved your PC", 100, 12

  • Change System Restore disk usage

    vssadmin resize shadowstorage /for=C: /on=C: /maxsize=10%

Enjoy

查看更多
登录 后发表回答