2012-10-02 68 views
7

我试图编写一个电源shell脚本来安装服务,但该服务需要一个额外的命令行参数传递给它。我很难让这个过去。通过installutil将参数传递给服务安装程序

这是使用参数的服务安装程序;

this.serviceInstaller.ServiceName = string.Format("My brill service {0}",this.Context.Parameters["environment"]) 

而我试过两种方式来传递paramiter;

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "C:\foo\bar.exe /environment:tomtest" 

(这给出了错误 “的网址无效目录”)

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /environment:tomtest "C:\foo\bar.exe" 

(这只是dosent更改服务名称)

任何想法?谢谢

回答

7

我非常接近,它的等于不是:。即;

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe /environment=tomtest "C:\foo\bar.exe" 
相关问题