System.Diagnostics.Process.Start(@"C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe")
无效?
答案 0 :(得分:3)
此代码可能会对您的System.Diagnostics.Process.Start Class
有所帮助using System;
using System.Diagnostics;
using System.ComponentModel;
namespace MyProcessSample
{
class MyProcess
{
public static void Main()
{
Process myProcess = new Process();
try
{
myProcess.StartInfo.UseShellExecute = false;
// You can start any process, HelloWorld is a do-nothing example.
myProcess.StartInfo.FileName = "C:\\HelloWorld.exe";
myProcess.StartInfo.CreateNoWindow = true;
myProcess.Start();
// This code assumes the process you are starting will terminate itself.
// Given that is is started without a window so you cannot terminate it
// on the desktop, it must terminate itself or you can do it programmatically
// from this application using the Kill method.
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
答案 1 :(得分:2)
Windows服务在用户的交互式会话之外运行,因此尽管可以执行某个过程,但您不应期望打开一个新窗口(在您的情况下是一个acrobat reader实例)。
此外,根据运行该服务的用户,您通常会对您可以做什么或不能做什么有安全限制。
答案 2 :(得分:0)