iT邦幫忙

0

想問一下 windows 裡面 服務有相依性 要下啥指令把服務逮帶起來

  • 分享至 

  • xImage
假設有 A B C 三個服務
想按照 ABC 順序 帶起來
我要下指令不是開服務然後滑鼠右鍵關閉 這種答案
harrytsai iT邦新手 1 級 ‧ 2022-02-08 17:23:35 檢舉
dos指令不就做的到了?
有一種語言,叫做shell
windows的話,也可用bat
對壓 但我要的是 上述的 指令 哈哈
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

2 個回答

1
leon123858
iT邦新手 3 級 ‧ 2022-02-08 17:24:28

用 powershell 實現

Stop-Service -DisplayName  "A" -Force
Start-Service -DisplayName  "A"
Stop-Service -DisplayName  "B" -Force
Start-Service -DisplayName  "B"
Stop-Service -DisplayName  "C" -Force
Start-Service -DisplayName  "C"

你試試吧 我不確定

1
Gary
iT邦好手 1 級 ‧ 2022-02-08 17:44:56

不知道有沒有貼近你的需求,試試看!

sc config ServiceA depend= ServiceB/ServiceC/ServiceD/"Service Name With Spaces"
How to add dependency on a Windows Service AFTER the service is installed
Automatic service start up and service dependency

我要發表回答

立即登入回答