使用照片查看器打开多个文件 [英] Open multiple files using photo viewer

查看:152
本文介绍了使用照片查看器打开多个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以从c#打开一个文件,如下所示:



string exe =C:\\Windows\\System32 \\rundll32 .exe

string arguments =C:\\Program Files(x86)\\ Windows Phone Viewer \\ PhotoViewer.dll \,ImageView_Fullscreen c:\ \ test.jpg;

Process.Start(exe,arguments);



但是当我尝试打开多个文件时如下< br $>


string exe =C:\\Windows\\System32 \\ rundll32.exe

string arguments = C:\\Program Files(x86)\\ Windows Phone Viewer \\PhotoViewer.dll \,ImageView_Fullscreen c:\\test.jpg&c:\\ test2。 jpg;

Process.Start(exe,arguments);



它适用于命令行,但它在c#中不起作用。有什么想法?

解决方案

首先,逃避第一个引号:

  string  arguments =   \C:\\Program文件(x86)\\ Windows照片查看器\\ PhotoViewer.dll \,ImageView_Fullscreen c:\\test.jpg& c:\\test2.jpg; 





我不想知道你的论证是否正确,更喜欢不同的观众。我希望你这样做只是为了实验,而不是在真实代码中硬编码立即常量



-SA

I can open one file from c# as follows:

string exe = "C:\\Windows\\System32\\rundll32.exe"
string arguments = ""C:\\Program Files (x86)\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen c:\\test.jpg";
Process.Start(exe, arguments);

but when I try opening multiple files as follows

string exe = "C:\\Windows\\System32\\rundll32.exe"
string arguments = ""C:\\Program Files (x86)\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen c:\\test.jpg & c:\\test2.jpg";
Process.Start(exe, arguments);

It works on the command line but it doesn't work in c#. Anyone have any ideas?

解决方案

First of all, escape the first quotation mark:

string arguments = "\"C:\\Program Files (x86)\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen c:\\test.jpg & c:\\test2.jpg";



I don't want to know if your argument are correct or not, prefer a different viewer. I hope you are doing this just for experiment at the moment, not going to hard-code immediate constants in "real" code.

—SA


这篇关于使用照片查看器打开多个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆