国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

安裝完成Windows服務后自動打開

2019-11-14 13:41:40
字體:
來源:轉載
供稿:網友

使用DOS進程開啟服務


設置servicePRocessInstaller1控件的Account屬性為“LocalSystem
設置serviceInstaller1控件的StartType屬性為"Automatic"

 

在服務器上添加安裝程序,在ProjectInstaller_AfterInstall(object sender, InstallEventArgs e)事件中,添加代碼

 1 System.Diagnostics.Process p = new System.Diagnostics.Process(); 2 p.StartInfo.FileName = "cmd.exe"; 3 p.StartInfo.UseShellExecute = false; 4 p.StartInfo.RedirectStandardInput = true; 5 p.StartInfo.RedirectStandardOutput = true; 6 p.StartInfo.RedirectStandardError = true; 7 p.StartInfo.CreateNoWindow = true; 8 p.Start(); 9 string Cmdstring = "sc start myservice"; //CMD命令10 p.StandardInput.WriteLine(Cmdstring);11 p.StandardInput.WriteLine("exit");

 


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 河间市| 满洲里市| 阳朔县| 桐柏县| 郎溪县| 余姚市| 峨山| 玛多县| 奉化市| 梓潼县| 靖安县| 金山区| 南和县| 土默特左旗| 嘉义县| 永定县| 肇东市| 张家港市| 东城区| 波密县| 蓬安县| 九江市| 墨脱县| 甘南县| 措勤县| 正阳县| 巴南区| 邮箱| 三明市| 东海县| 乌拉特后旗| 汾西县| 嘉定区| 山丹县| 顺义区| 贺州市| 原平市| 舒城县| 清水县| 勐海县| 巴青县|