C# GhostScript未在64位操作系统中运行

C# GhostScript未在64位操作系统中运行,c#,cmd,ghostscript,C#,Cmd,Ghostscript,下面的C#代码我可以在Windows7 32位操作系统中运行,但不能在Windows7 64位操作系统中运行。甚至我对每个文件都使用了替代工作目录,但我不知道为什么它不生成TIFF文件 注意:如果我使用直接命令提示符,其工作正常。但在C语言中,它不起作用 System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo

下面的C#代码我可以在Windows7 32位操作系统中运行,但不能在Windows7 64位操作系统中运行。甚至我对每个文件都使用了替代工作目录,但我不知道为什么它不生成TIFF文件

注意:如果我使用直接命令提示符,其工作正常。但在C语言中,它不起作用

       System.Diagnostics.Process process = new System.Diagnostics.Process();
        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
        startInfo.WorkingDirectory = @"C:\Program Files (x86)\gs\gs9.14\bin";

        //startInfo.WorkingDirectory = @"C:\Program Files\gs\gs9.14\bin"; 

        startInfo.FileName = "cmd.exe";
        startInfo.Verb = "runas";

        startInfo.Arguments = "/c gswin32c -dBATCH -sDEVICE=tiff24nc -sCompression=lzw -r300x300  -dNOPAUSE -sOutputFile=D:\\Test\\Project%04d.tiff E:\\21062014\\MedSoft\\MedSoft\\bin\\Debug\\Output\\02_Combined.pdf";

        process.StartInfo = startInfo;
        process.Start();

我建议您为.NET使用Ghostscript包装器

你可以在这里找到一个:


可以在这里找到使用示例:

如果
C:\ProgramFiles(x86)
不存在,它如何在32位windows中工作?您的项目目标设置是什么,32位还是64位?不,我实际上更改了工作目录。您可以看到我刚才评论的用于64位操作系统的x86代码。我的目标设置是32位。32位和64位窗口不需要单独的行。请尝试
“%ProgramFiles%\gs\gs9.14\bin”
,它将始终返回32位程序文件文件夹。或
%ProgramW6432%
返回默认的程序文件文件夹,具体取决于32位或64位窗口。不要硬编码它们