.net 如何在命令行中运行 Photoviewer.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6190271/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 15:36:20  来源:igfitidea点击:

How to run Photoviewer.dll in command line

.netwindows-764-bittiffphotoviewer

提问by jinsungy

When I run the following code below in a command prompt (as administrator):

当我在命令提示符下运行以下代码时(以管理员身份):

"C:\Program Files\Windows Photo Viewer\PhotoViewer.dll" "C:
rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen path_to_image
012.tif"

it produces error as shown below :

它产生如下所示的错误:

"This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an associated in the Default Programs control panel."

“该文件没有与之关联的程序来执行此操作。请安装一个程序,或者,如果已经安装了一个程序,请在默认程序控制面板中创建一个关联程序。”

Both .tifand .tiffare associated in the Default programs control panel.

双方.tif.tiff在默认程序控制面板相关。

I am trying to call this from a .net windows app.

我正在尝试从 .net Windows 应用程序调用它。

Any help is appreciated.

任何帮助表示赞赏。

采纳答案by RobinJ

rundll32 "C:\Program Files\Windows Photo Viewer\PhotoViewer.dll" "C:\00012.tif"

rundll32 "C:\Program Files\Windows 照片查看器\PhotoViewer.dll" "C:\00012.tif"

For running a dll, there is rundll32.

为了运行一个 dll,有rundll32.

回答by user362515

Windows 7

Windows 7的

C:\Users\alphaniner> explorer Documents\test.png
  • path_to_image must notbe quoted!
  • path_to_image不能被引用!

回答by alphaniner

It's not necessary to run PhotoViewer directly, let explorer do the work for you. As a bonus, it works with relative paths as far as I can tell.

无需直接运行 PhotoViewer,让资源管理器为您完成工作。作为奖励,据我所知,它适用于相对路径。

##代码##