Created
December 11, 2018 07:30
-
-
Save jaka/4626840dd5b7ab41366f86b40218aa49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Set-Default([Array]$Exts, [String]$Value) | |
{ | |
ForEach ($Ext in $Exts) | |
{ | |
$Classes = "HKLM:\SOFTWARE\Classes\" | |
$Path = Join-Path -Path $Classes -ChildPath $Ext | |
Set-ItemProperty -Path $Path -Name "(Default)" -Type String -Force -Value $Value | |
} | |
} | |
$bmp = @(".bmp", ".dib") | |
Set-Default -Exts $bmp -Value "PhotoViewer.FileAssoc.Bitmap" | |
$gif = @(".gif") | |
Set-Default -Exts $gif -Value "PhotoViewer.FileAssoc.Gif" | |
$jiff = @(".jiff") | |
Set-Default -Exts $jpeg -Value "PhotoViewer.FileAssoc.Jfif" | |
$jpeg = @(".jpe", ".jpeg", ".jpg") | |
Set-Default -Exts $jpeg -Value "PhotoViewer.FileAssoc.Jpeg" | |
$png = @(".png") | |
Set-Default -Exts $png -Value "PhotoViewer.FileAssoc.Png" | |
$tiff = @(".cr2", ".tif", ".tiff") | |
Set-Default -Exts $tiff -Value "PhotoViewer.FileAssoc.Tiff" | |
$wdp = @(".wdp", ".jxr") | |
Set-Default -Exts $wdp -Value "PhotoViewer.FileAssoc.Wdp" | |
$all = $bmp + $gif + $jiff + $jpeg + $png + $tiff + $wdp | |
$s_All = $all -Join "|" | |
$SystemFileAssociations = "HKLM:\SOFTWARE\Classes\SystemFileAssociations\" | |
Get-ChildItem -Path $SystemFileAssociations | where {$_.Name -Match $s_All} | ForEach | |
{ | |
$Parent = Join-Path -Path $SystemFileAssociations -ChildPath $_.PSChildName | |
$Path = Join-Path -Path $Parent -ChildPath "Shell\3D Edit" | |
if (Test-Path -Path $Path) | |
{ | |
Remove-Item -Recurse -Path $Path | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment