18

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

"C:\Program Files\Windows Photo Viewer\PhotoViewer.dll" "C:\00012.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 .tif and .tiff are associated in the Default programs control panel.

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

Any help is appreciated.

4 Answers 4

37

Windows 7

rundll32 "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen path_to_image
  • path_to_image must not be quoted!
6
  • Just as a side note to Laerne's point, path_to_image must be the full path to the file, NOT the relative path. Made this mistake a few times myself.
    – Ben
    Feb 1, 2016 at 21:01
  • 5
    path_to_image must NOT be quoted! May 23, 2016 at 10:10
  • 1
    Is there a way to then start a diaporama ? Mar 7, 2017 at 8:56
  • 1
    How to use this with a file that has space in it, if I cannot use quotes? Mar 10, 2017 at 11:25
  • 3
    Is there a place where rundll32-accessible functions are listed for this? Maybe there are other things available besides ImageViewer_Fullscreen?
    – xdhmoore
    Aug 27, 2017 at 0:24
13

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

For running a dll, there is rundll32.

3
  • 3
    Nothing is opened after running this on Windows 10.
    – msl
    Jul 13, 2020 at 10:58
  • Yeah, nothing happens on Windows 10! What's wrong?
    – LShadow77
    Feb 19, 2021 at 21:55
  • 1
    I'd say that's unsurprising considering there have been 10 years of changes to Windows since this answer was written :)
    – RobinJ
    Mar 2, 2021 at 15:26
13

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.

C:\Users\alphaniner> explorer Documents\test.png
2
  • The OP asks specifically how to call PhotoViewer.
    – user362515
    Apr 6, 2016 at 18:12
  • 1
    Note that this is not guaranteed to run PhotoViewer, it runs whatever program you have associated with the .png extension.
    – jrh
    Nov 5, 2018 at 18:22
0

By definition this answers the ops question but it may not be what he wants.

"C:\Windows\system32\mspaint.exe" "C:\somepic.png"

Not the answer you're looking for? Browse other questions tagged or ask your own question.