installutilMyService.exeに引数を渡す方法Parameter1Parameter2
MyServiceはWindowsサービスです。このサービスに引数を渡したい。
installutilMyService.exeに引数を渡す方法Parameter1Parameter2
MyServiceはWindowsサービスです。このサービスに引数を渡したい。
ProjectInstaller クラスの install メソッドをオーバーライドする
public override void Install(System.Collections.IDictionary stateSaver)
{
base.Install(stateSaver);
string lParam1 = Convert.ToString(GetParam("Param1"));
}
private object GetParam(string p)
{
try
{
if (this.Context != null)
{
if (this.Context.Parameters != null)
{
string lParamValue = this.Context.Parameters[p];
if (lParamValue != null)
return lParamValue;
}
}
}
catch (Exception ex )
{
}
return string.Empty;
}
を使用してサービスをインストールしますinstallutil /Param1=value path_to_your_exename