Windows 10: How to associate Photo Viewer using ftype and assoc


  1. Posts : 7
    Windows 10
       01 Mar 2018 #1

    How to associate Photo Viewer using ftype and assoc


    Hello.
    I want to associate png, bmp, jpg/jpeg with Windows Photo Viewer in Windows 10 (8.1) through console and without using GUI (Settings — Apps — Default apps — setting up Photo Viewer as a default app).
    Here is my code, but unfortunately it doesn't associate at all, but works with out any errors. Restarting Explorer or PC doesn't help.
    Code:
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget -Force
    }
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open -Name MuiVerb -Type String -Value "@photoviewer.dll,-3043" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Name Clsid -Type String -Value "{60fd46de-f830-4894-a628-6fa81bc0190d}" -Force
    
    cmd.exe /c "assoc .bmp=Paint.Picture"
    cmd.exe /c "assoc .jpg=jpegfile"
    cmd.exe /c "assoc .jpeg=jpegfile"
    cmd.exe /c "assoc .png=pngfile"
    cmd.exe /c "assoc .tif=TIFImage.Document"
    cmd.exe /c "assoc .tiff=TIFImage.Document"
    
    cmd.exe /c 'ftype Paint.Picture=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype jpegfile=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype pngfile=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype TIFImage.Document=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    Source: https://www.reddit.com/r/sysadmin/comments/72vv31/set_windows_photo_viewer_as_default_app_on/
    Source 2: Forcing Windows to use Windows Photo Viewer | NHL Data Blog
    How to really(!) associate an file extension to new program? - DosTips.com
    Last edited by farag; 01 Mar 2018 at 04:58.
      My ComputerSystem Spec

  2.    01 Mar 2018 #2

    Why not
    a. associate it
    b. export the relevant keys
    c. build a reg file that you can merge
    registry - Add reg file via Command Line on Windows CE device - Stack Overflow

    Just a thought..
      My ComputerSystem Spec


  3. Posts : 7
    Windows 10
    Thread Starter
       01 Mar 2018 #3

    dalchina said: View Post
    Why not
    The main key for me is not to mark "Always use this app...". After excuting script I want to open jpg, bmp files instantly. Anyway, may be it's not possible, only through Settings.
      My ComputerSystem Spec

  4.    01 Mar 2018 #4

    So your question becomes
    If I merged the registry file, would the effect be immediate?
    Quite often registry changes require that explorer be restarted to be applied. I've not experienced what happens if you change associations by editing the registry though.

    I assume you are experiencing a change in association, and want this always to be photoviewer.
    If so, the question then is - what is changing your association?

    Otherwise perhaps you could state the perceived problem you're trying to solve.
    Last edited by dalchina; 01 Mar 2018 at 06:04.
      My ComputerSystem Spec


  5. Posts : 7
    Windows 10
    Thread Starter
       05 Mar 2018 #5

    So I've found the solution to associate with Windows Photo Viewer instantly without restarting PC. But you need to uninstall UWP photo app before.
    Code:
    Get-AppxPackage -AllUsers | Where-Object name -CNotLike *Store* | Remove-AppxPackage -ErrorAction SilentlyContinue
    Get-AppxProvisionedPackage -Online | Where-Object DisplayName -CNotLike *Store* | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
    
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command -Force
    }
    IF (!(Test-Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget))
    {
        New-Item -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\DropTarget -Force
    }
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open -Name MuiVerb -Type String -Value "@photoviewer.dll,-3043" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Name Clsid -Type String -Value "{FFE2A43C-56B9-4bf5-9A79-CC6D4285608A}" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\print\command -Name "(Default)" -Type ExpandString -Value "%SystemRoot%\System32\rundll32.exe `"%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll`", ImageView_Fullscreen %1" -Force
    New-ItemProperty -Path Registry::HKEY_CLASSES_ROOT\Applications\photoviewer.dll\shell\open\DropTarget -Name Clsid -Type String -Value "{60fd46de-f830-4894-a628-6fa81bc0190d}" -Force
    
    cmd.exe /c 'ftype Paint.Picture=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype jpegfile=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype pngfile=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c 'ftype TIFImage.Document=%windir%\System32\rundll32.exe "%ProgramFiles%\Windows Photo Viewer\PhotoViewer.dll", ImageView_Fullscreen %1'
    cmd.exe /c "assoc .bmp=Paint.Picture"
    cmd.exe /c "assoc .jpg=jpegfile"
    cmd.exe /c "assoc .jpeg=jpegfile"
    cmd.exe /c "assoc .png=pngfile"
    cmd.exe /c "assoc .tif=TIFImage.Document"
    cmd.exe /c "assoc .tiff=TIFImage.Document"
    cmd.exe /c "assoc Paint.Picture\DefaultIcon=%SystemRoot%\System32\imageres.dll,-70"
    cmd.exe /c "assoc jpegfile\DefaultIcon=%SystemRoot%\System32\imageres.dll,-72"
    cmd.exe /c "assoc pngfile\DefaultIcon=%SystemRoot%\System32\imageres.dll,-71"
    cmd.exe /c "assoc TIFImage.Document\DefaultIcon=%SystemRoot%\System32\imageres.dll,-122"
      My ComputerSystem Spec


 

Related Threads
How do I get the previous Photo Viewer back? The version (yesterday) where I can move to next photo with mouse scroll? Now suddenly (today) without me doing any changes in the app the scroll is zooming the photos. Also the appearance of the app is...
Solved Alternative to Photo Viewer. in Software and Apps
Hi. :) I am using build 10147 now, and Windows Photo Viewer is not working here as it used to. The new look/appearence of the Photos App is very cool, but is there any third party software that can be an alternative of the good old Windows Photo...
I recently purchased a new laptop (Dell Inspirion 17 5000 series) and I am so upset to see that Windows 10 does not have the Windows Photo Viewer or the Windows Live Photo Gallery- these two programs offer ways of printing photos (such as printing 2...
Photo Viewer in Software and Apps
After a recent update I can no longer use the photo viewer, the tile does not respond and nothing happens when I pop my SD card in. I used it with no problems on windows 8.1. I have tried various settings using auto play to no avail.
Hai, Jpg photo unable to open in windows photo viewer. i reset default apps. i choose default apps by file type. 28169281702817128172 Regards. bala.
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 02:41.
Find Us