I can run this fine from the command line:
C:\Windows\System32\rundll32.exe "C:\Program Files (x86)\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen C:\Users\Public\Pictures\Sample Pictures\Chrysanthemum.jpg
Image opens no problem.
However, when I try and do this:
exe = "C:\\Windows\\System32\\rundll32.exe \"C:\\Program Files (x86)\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen C:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg";
Process.Start(exe);
I get a
System.ComponentModel.Win32Exception: The system cannot find the file specified
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.
What's going on?
Turns out one has to pass the command and arguments separately:
exe = "C:\\Windows\\System32\\rundll32.exe";
arguments = "\"C:\\Program Files (x86)\\Windows Photo Viewer\\PhotoViewer.dll\", ImageView_Fullscreen C:\\Users\\Public\\Pictures\\Sample Pictures\\Chrysanthemum.jpg";
Process.Start(exe, arguments);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With