Last active
December 9, 2024 17:17
-
-
Save eggbean/315355ecdf17c41347e835ffafd08326 to your computer and use it in GitHub Desktop.
Revisions
-
eggbean revised this gist
Aug 15, 2024 . 1 changed file with 83 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,83 @@ # Adds shell integration for WinDirStat. The program should be installed in # Program Files (x86) but it will check if that directory is not on C: # # Alternatively, if installed on C: you can use the reg file below instead. if (-not ([security.principal.windowsprincipal][security.principal.windowsidentity]::getcurrent()).isinrole([security.principal.windowsbuiltinrole]::administrator)) { write-error "this script needs to be run as an administrator. please restart powershell as an administrator and try again." exit } new-psdrive -name hkcr -psprovider registry -root hkey_classes_root $windirstatpath = join-path ${env:programfiles(x86)} "windirstat\windirstat.exe" if ([string]::isnullorempty($windirstatpath) -or !(test-path $windirstatpath)) { write-error "windirstat not found at $windirstatpath. please check the installation path." exit } function add-registryentry { param ( [string]$path, [hashtable]$properties ) if (-not (test-path $path)) { new-item -path $path -force | out-null } foreach ($prop in $properties.getenumerator()) { set-itemproperty -path $path -Name $prop.Key -Value $prop.Value } } $registryEntries = @( @{ Path = "HKCR:\Directory\Background\shell\windirstat" Properties = @{ "(Default)" = "Open WinDirStat here" "Icon" = "$winDirStatPath,0" } }, @{ Path = "HKCR:\Directory\Background\shell\windirstat\command" Properties = @{ "(Default)" = """$winDirStatPath"" ""%V""" } }, @{ Path = "HKCR:\Directory\shell\windirstat" Properties = @{ "(Default)" = "Open WinDirStat here" "Icon" = "$winDirStatPath,0" } }, @{ Path = "HKCR:\Directory\shell\windirstat\command" Properties = @{ "(Default)" = """$winDirStatPath"" ""%1""" } }, @{ Path = "HKCR:\Drive\shell\windirstat" Properties = @{ "(Default)" = "Open WinDirStat here" "Icon" = "$winDirStatPath,0" } }, @{ Path = "HKCR:\Drive\shell\windirstat\command" Properties = @{ "(Default)" = """$winDirStatPath"" ""%1\""" } } ) foreach ($entry in $registryEntries) { Add-RegistryEntry -Path $entry.Path -Properties $entry.Properties } Write-Host "Registry entries for WinDirStat have been added successfully." Remove-PSDrive -Name HKCR -
eggbean revised this gist
Aug 15, 2024 . 1 changed file with 5 additions and 29 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,46 +1,22 @@ Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat] @="Open WinDirStat here" "Icon"="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe,0" [HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%V\"" [HKEY_CLASSES_ROOT\Directory\shell\windirstat] @="Open WinDirStat here" "Icon"="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe,0" [HKEY_CLASSES_ROOT\Directory\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%1\"" [HKEY_CLASSES_ROOT\Drive\shell\windirstat] @="Open WinDirStat here" "Icon"="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe,0" [HKEY_CLASSES_ROOT\Drive\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%1\\\"" -
eggbean created this gist
Oct 6, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,46 @@ Windows Registry Editor Version 5.00 [-HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat] [HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat] @="Open WinDirStat here" [HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat] "Icon"=hex(2):43,00,3A,00,5C,00,50,00,72,00,6F,00,67,00,72,00,61,00,6D,00,20,\ 00,46,00,69,00,6C,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5C,00,\ 57,00,69,00,6E,00,44,00,69,00,72,00,53,00,74,00,61,00,74,00,5C,00,77,00,69,\ 00,6E,00,64,00,69,00,72,00,73,00,74,00,61,00,74,00,2E,00,65,00,78,00,65,00,\ 2C,00,30,00 [HKEY_CLASSES_ROOT\Directory\Background\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%1\"" [-HKEY_CLASSES_ROOT\Directory\shell\windirstat] [HKEY_CLASSES_ROOT\Directory\shell\windirstat] @="Open WinDirStat here" [HKEY_CLASSES_ROOT\Directory\shell\windirstat] "Icon"=hex(2):43,00,3A,00,5C,00,50,00,72,00,6F,00,67,00,72,00,61,00,6D,00,20,\ 00,46,00,69,00,6C,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5C,00,\ 57,00,69,00,6E,00,44,00,69,00,72,00,53,00,74,00,61,00,74,00,5C,00,77,00,69,\ 00,6E,00,64,00,69,00,72,00,73,00,74,00,61,00,74,00,2E,00,65,00,78,00,65,00,\ 2C,00,30,00 [HKEY_CLASSES_ROOT\Directory\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%1\"" [-HKEY_CLASSES_ROOT\Drive\shell\windirstat] [HKEY_CLASSES_ROOT\Drive\shell\windirstat] @="Open WinDirStat here" [HKEY_CLASSES_ROOT\Drive\shell\windirstat] "Icon"=hex(2):43,00,3A,00,5C,00,50,00,72,00,6F,00,67,00,72,00,61,00,6D,00,20,\ 00,46,00,69,00,6C,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5C,00,\ 57,00,69,00,6E,00,44,00,69,00,72,00,53,00,74,00,61,00,74,00,5C,00,77,00,69,\ 00,6E,00,64,00,69,00,72,00,73,00,74,00,61,00,74,00,2E,00,65,00,78,00,65,00,\ 2C,00,30,00 [HKEY_CLASSES_ROOT\Drive\shell\windirstat\command] @="C:\\Program Files (x86)\\WinDirStat\\windirstat.exe \"%1\"" LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed.