Windows サービスをプログラムでインストールするにはどうすればよいですか?
登録ボタンをクリックして Windows サービスをインストールし、登録解除ボタンをクリックしてアンインストールしたいと考えています。
Windows サービスをプログラムでインストールするにはどうすればよいですか?
登録ボタンをクリックして Windows サービスをインストールし、登録解除ボタンをクリックしてアンインストールしたいと考えています。
参照 (ただし、C#の場合):
C#でWindowsサービスをプログラムでインストールする方法は?
//Installs and starts the service
ServiceInstaller.InstallAndStart("MyServiceName", "MyServiceDisplayName", "C:\PathToServiceFile.exe");
//Removes the service
ServiceInstaller.Uninstall("MyServiceName");
//Checks the status of the service
ServiceInstaller.GetServiceStatus("MyServiceName");
//Starts the service
ServiceInstaller.StartService("MyServiceName");
//Stops the service
ServiceInstaller.StopService("MyServiceName");
//Check if service is installed
ServiceInstaller.ServiceIsInstalled("MyServiceName");