C#之 使用Process打开文件
2021-03-28 17:24
标签:tar alc message box 启动 ica 存在 style cat Process可以打开文件,也可以打开exe的运行程序 现在先来说一下如何打开word文档: 打开Config文件: 打开Windows自带的计算器程序: C#之 使用Process打开文件 标签:tar alc message box 启动 ica 存在 style cat 原文地址:http://blog.51cto.com/13758648/2146022 string fileNewPat = Application.StartupPath;
string fileName = fileNewPat+@"\doc\程沐喆.doc";
if (File.Exists(fileName))
{
Process process1 = new Process();
process1.StartInfo.FileName = fileName;
process1.StartInfo.Arguments = "";
process1.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
process1.Start();
}
else
{
MessageBox.Show("文件不存在");
}
string stConfigFileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
stConfigFileName = Path.Combine(stConfigFileName, "UserConfigSettings");
stConfigFileName += @".config";
Process process1 = new Process();
process1.StartInfo.FileName = "calc.exe";
process1.StartInfo.Arguments = "";
process1.StartInfo.WindowStyle = ProcessWindowStyle.Maximized;
process1.Start();