C#怎样打开相对路径下面的外部程序? C# winform 怎样打开相对路径下面的外部程序? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void OpenCmd(string ServerName , string UserName ,string Pass ) { Process info = new Process(); info.StartInfo.FileName = @"c:\Windows\System32\cmd.exe"; info.StartInfo.WorkingDirectory = @"C:\"; info.StartInfo.UseShellExecute = false; info.StartInfo.RedirectStandardInput = true; //重定向标准输入 info.StartInfo.RedirectStandardOutput = true; //重定向标准输出 info.StartInfo.RedirectStandardError = true; //重定向错误输出 info.StartInfo.CreateNoWindow = false; info.Start(); string path = @"net use \\"+ ServerName+ textBox1.Text +@"LCAPP /User:"+ UserName +" "+ Pass+""; info.StandardInput.WriteLine(path); info.StandardInput.WriteLine("Exit"); info.Close(); } 我在网上找的,不知道对不对,你看看吧 http://edu.codepub.com/2010/0805/24867_3.php Process.Start("YourExeFile.exe")即可 Process info = new Process();p.StartInfo.FileName = Application.StartPath+@"";p.StartInfo.WorkingDirectory = @"";p.StartInfo.UseShellExecute = false;p.StartInfo.CreateNoWindow = false; p.Start();System.Environment.CurrentDirectory 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。 System.IO.Directory.GetCurrentDirectory() 获取应用程序的当前工作目录。System.AppDomain.CurrentDomain.BaseDirectory 获取程序的基目录。 以上的都行。!主要用到的类是Process。关于它的使用你可以查看MSDN 谁知道游戏里的锻造技术怎么做的? asp.net用mvc时,视图中的dropdownlist怎么实现? WCF的配置文件出现标记未关闭,怎么改? 【版务帖】2008年10月C#版务帖 Sharepoint 开发的两个问题 请大侠进来看看这是报的什么错啊,该怎么改才行啊?先谢了! 求一正确正则表达式!谢谢大家! 请教listBox中item项目双击事件的问题 如何用c#制作一个文件资源管理器 使用 UdpClient 时 如何将汉字编码为 字符数组 弱弱地问一下,.net操作 mysql 数据库方便吗? 怎样通过代码创建本地连接?
{
Process info = new Process();
info.StartInfo.FileName = @"c:\Windows\System32\cmd.exe";
info.StartInfo.WorkingDirectory = @"C:\";
info.StartInfo.UseShellExecute = false;
info.StartInfo.RedirectStandardInput = true; //重定向标准输入
info.StartInfo.RedirectStandardOutput = true; //重定向标准输出
info.StartInfo.RedirectStandardError = true; //重定向错误输出
info.StartInfo.CreateNoWindow = false;
info.Start(); string path = @"net use \\"+ ServerName+ textBox1.Text +@"LCAPP /User:"+ UserName +" "+ Pass+"";
info.StandardInput.WriteLine(path);
info.StandardInput.WriteLine("Exit");
info.Close();
} 我在网上找的,不知道对不对,你看看吧
即可
p.StartInfo.FileName = Application.StartPath+@"";
p.StartInfo.WorkingDirectory = @"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = false;
p.Start();
System.Environment.CurrentDirectory
获取和设置当前目录(该进程从中启动的目录)的完全限定目录。
System.IO.Directory.GetCurrentDirectory()
获取应用程序的当前工作目录。
System.AppDomain.CurrentDomain.BaseDirectory
获取程序的基目录。