Re: [問題] 如何於視窗程式執行特定程式?

看板C_Sharp作者 (小新)時間17年前 (2009/02/27 14:30), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
※ 引述《liaommx (Orz)》之銘言: : 一個透過C#執行特定程式的問題請教. : win xp下面, : 開始->執行 : 輸入"mstsc /v:123.456.789.123" : 可以自動啟動遠端桌面到特定的ip位置. : 若是希望撰寫一個視窗程式. : 啟動就是一個按鈕. : 按下該按鈕以後,可以自動執行mstsc,並連接 : 這樣的想法該怎麼實現比較適合呢? : 是要呼叫cmd.exe再去執行mstsc : 還是 : 直接呼叫mstsc? : 又,此兩種方法,相對應的語法該怎麼撰寫呢? 直接呼叫MSTSC就好啦. 那請使用Process ex : Process compiler = new Process(); compiler.StartInfo.FileName = "csc.exe"; compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs"; compiler.StartInfo.UseShellExecute = false; compiler.StartInfo.RedirectStandardOutput = true; compiler.Start(); Console.WriteLine(compiler.StandardOutput.ReadToEnd()); compiler.WaitForExit(); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 203.66.222.12
文章代碼(AID): #19fuXnj9 (C_Sharp)
文章代碼(AID): #19fuXnj9 (C_Sharp)