Re: [問題] 如何於視窗程式執行特定程式?
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):