作者cat1020 (小新)
看板C_Sharp
标题Re: [问题] 如何於视窗程式执行特定程式?
时间Fri Feb 27 14:30:08 2009
※ 引述《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