无法从运行的Process.Start命令命令、Process、Start

由网友(眼淚磨成細沙)分享简介:我可以在命令行中运行此罚款:I can run this fine from the command line:C:\Windows\System32\rundll32.exe "C:\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll", ImageV...

我可以在命令行中运行此罚款:

I can run this fine from the command line:

C:WindowsSystem32rundll32.exe "C:Program Files (x86)Windows Photo ViewerPhotoViewer.dll", ImageView_Fullscreen  C:UsersPublicPicturesSample PicturesChrysanthemum.jpg

图片打开没问题。

Image opens no problem.

然而,当我试着这样做:

However, when I try and do this:

exe = "C:WindowsSystem32rundll32.exe "C:Program Files (x86)Windows Photo ViewerPhotoViewer.dll", ImageView_Fullscreen  C:UsersPublicPicturesSample PicturesChrysanthemum.jpg";
Process.Start(exe);

我收到了

System.ComponentModel.Win32Exception:系统找不到指定文件

System.ComponentModel.Win32Exception: The system cannot find the file specified

我试图与这两个命令行和C#,并没有工作,他们的报价。据一个答案我读的SO最近半句不应该被引用。

I have tried with quotes on both the command line and C#, and neither work with them. According to an answer I read on SO recently the last part should not be quoted.

这是怎么回事?

推荐答案

原来一个人单独传递命令和参数:

Turns out one has to pass the command and arguments separately:

exe = "C:WindowsSystem32rundll32.exe";
arguments = ""C:Program Files (x86)Windows Photo ViewerPhotoViewer.dll", ImageView_Fullscreen  C:UsersPublicPicturesSample PicturesChrysanthemum.jpg";
Process.Start(exe, arguments);
阅读全文

相关推荐

最新文章