Skip to main content
 首页 » 编程设计

c#之Windows 7 中是否存在 explorer.exe 问题

2024年02月24日21cyq1162

s += "<p style=\"text-align: left;\"><a href=\"javascript:window.print()\">PRINT</a></p>"; 
System.IO.File.WriteAllText(@"CheckForm.html", s); 
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); 
startInfo.FileName = "explorer.exe"; 
startInfo.Arguments = "CheckForm.html"; 
System.Diagnostics.Process.Start(startInfo); 

当我尝试在 Windows 7 中打开我的 C# Windows 应用程序时遇到问题,否则没有问题。

我无法使用上面的代码在 Windows 7 中打开 explorer.exe。

有什么建议吗?

请您参考如下方法:

要打开 HTML 文件,您只需使用文件路径调用 Process.Start,如下所示:

Process.Start(@"CheckForm.html"); 

这将在默认程序中打开文件。 (通常是 IE 或 Firefox)