New
#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.
Source: https://www.reddit.com/r/sysadmin/comments/72vv31/set_windows_photo_viewer_as_default_app_on/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 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.