====== 01 サービス(scコマンド) ======
===== サービスの確認 =====
-動いてるサービスの一覧
sc query | findstr /i service_name
-止まっているサービスの一覧
sc query state= inactive | findstr /i service_name
-登録されているすべてのサービス
sc query state= all | findstr /i service_name
===== サービスの作成・削除 =====
-サービス作成
sc create hoge(サービス名) binpath= C:\hoge\jhoge.exe(実行ファイル)
-サービスの削除
sc delete hoge(サービス名)
===== サービスの「手動 / 自動 / 無効」の変更 =====
sc config hoge(サービス名) start= |auto(自動) | demand(手動) | disabled(無効) |
-手動
sc config Schedule start= demand
-自動
sc config Schedule start= auto
-無効
sc config Schedule start= disabled
* この例は、タスクスケジューラの設定例です。
* start= の後ろにスペースが必要である事に注意して下さい。
* Schedule は、サービス名です。表示名ではありません
* 成功すると、[SC] ChangeServiceConfig SUCCESS と表示されます