このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
03_windows:05_command_prompt:01_service_command [2014/08/06 06:20] – 03_windows:05_コマンドプロンプト:サービス一覧 renamed to 03_windows:05_command_prompt:01_service_command matsui | 03_windows:05_command_prompt:01_service_command [2014/08/06 06:27] (現在) – matsui | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== 01 サービス(scコマンド) ====== | ||
+ | ===== サービスの確認 ===== | ||
+ | -動いてるサービスの一覧 | ||
+ | <code console> | ||
+ | sc query | findstr /i service_name | ||
+ | </ | ||
+ | |||
+ | -止まっているサービスの一覧 | ||
+ | <code console> | ||
+ | sc query state= inactive | findstr /i service_name | ||
+ | </ | ||
+ | |||
+ | -登録されているすべてのサービス | ||
+ | <code console> | ||
+ | sc query state= all | findstr /i service_name | ||
+ | </ | ||
+ | |||
+ | ===== サービスの作成・削除 ===== | ||
+ | |||
+ | -サービス作成 | ||
+ | <code console> | ||
+ | sc create hoge(サービス名) binpath= C: | ||
+ | </ | ||
+ | |||
+ | -サービスの削除 | ||
+ | <code console> | ||
+ | sc delete hoge(サービス名) | ||
+ | </ | ||
+ | |||
+ | ===== サービスの「手動 / 自動 / 無効」の変更 ===== | ||
+ | <code console> | ||
+ | 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 と表示されます |