Skip to content

Commit

Permalink
v4.14.0
Browse files Browse the repository at this point in the history
- right click context menu updated
  • Loading branch information
caglaryalcin committed Sep 29, 2024
1 parent f880bfb commit 0c550b8
Showing 1 changed file with 82 additions and 16 deletions.
98 changes: 82 additions & 16 deletions resume.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ Function UnusedApps {
Write-Host "Editing the right click menu..." -NoNewline
# New PS Drives
New-PSDrive -Name "HKCR" -PSProvider "Registry" -Root "HKEY_CLASSES_ROOT" | Out-Null

# Old right click menu
$regPath = "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32"
reg.exe add $regPath /f /ve *>$null
Expand All @@ -813,60 +813,126 @@ Function UnusedApps {
"HKEY_CLASSES_ROOT\CLSID\{450D8FBA-AD25-11D0-98A8-0800361B1103}\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
"HKEY_CLASSES_ROOT\Directory\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
"HKEY_CLASSES_ROOT\Drive\shellex\ContextMenuHandlers\{596AB062-B4D2-4215-9F74-E9109B0A8153}",
#remove "Include in library"
"HKEY_CLASSES_ROOT\Folder\ShellEx\ContextMenuHandlers\Library Location",
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\ShellEx\ContextMenuHandlers\Library Location"
#remove "copy as path"
"HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AllFilesystemObjects\shellex\ContextMenuHandlers\CopyAsPathMenu"
#remove git
"HKEY_CLASSES_ROOT\Directory\Background\shell\git_gui",
"HKEY_CLASSES_ROOT\Directory\Background\shell\git_shell",
#remove treesize
"HKEY_CLASSES_ROOT\Directory\Background\shell\TreeSize Free",
"HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode"
#remove mpc player
"HKEY_CLASSES_ROOT\Directory\shell\mplayerc64.enqueue"
#remove sharex
"HKEY_CLASSES_ROOT\Directory\shell\ShareX"
#remove vlc
"HKEY_CLASSES_ROOT\Directory\shell\AddToPlaylistVLC"
)

foreach ($path in $contextMenuPaths) {
$regPath = $path -replace 'HKCR:\\', 'HKEY_CLASSES_ROOT\'
$cmd = "reg delete `"$regPath`" /f"

Invoke-Expression $cmd *>$null
}

# New hash menu for right click
$regpath = "HKEY_CLASSES_ROOT\*\shell\hash"
$sha256menu = "HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu"
$md5menu = "HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu"

reg add $regpath /f *>$null
reg add $regpath /v "MUIVerb" /t REG_SZ /d HASH /f *>$null
reg add $regpath /v "SubCommands" /t REG_SZ /d """" /f *>$null
reg add "$regpath\shell" /f *>$null

reg add "$sha256menu" /f *>$null
reg add "$sha256menu\command" /f *>$null
reg add "$sha256menu" /v "MUIVerb" /t REG_SZ /d SHA256 /f *>$null

$tempOut = [System.IO.Path]::GetTempFileName()
$tempErr = [System.IO.Path]::GetTempFileName()
Start-Process cmd.exe -ArgumentList '/c', 'reg add "HKEY_CLASSES_ROOT\*\shell\hash\shell\02menu\command" /ve /d "powershell -noexit get-filehash -literalpath \"%1\" -algorithm SHA256 | format-list" /f' -NoNewWindow -RedirectStandardOutput $tempOut -RedirectStandardError $tempErr
Remove-Item $tempOut -ErrorAction Ignore
Remove-Item $tempErr -ErrorAction Ignore

reg add "$md5menu" /f *>$null
reg add "$md5menu\command" /f *>$null
reg add "$md5menu" /v "MUIVerb" /t REG_SZ /d MD5 /f *>$null

$tempOut = [System.IO.Path]::GetTempFileName()
$tempErr = [System.IO.Path]::GetTempFileName()
Start-Process cmd.exe -ArgumentList '/c', 'reg add "HKEY_CLASSES_ROOT\*\shell\hash\shell\03menu\command" /ve /d "powershell -noexit get-filehash -literalpath \"%1\" -algorithm MD5 | format-list" /f' -NoNewWindow -RedirectStandardOutput $tempOut -RedirectStandardError $tempErr
Remove-Item $tempOut -ErrorAction Ignore
Remove-Item $tempErr -ErrorAction Ignore


# Add Turn Off Display Menu
$turnOffDisplay = "HKEY_CLASSES_ROOT\DesktopBackground\Shell\TurnOffDisplay"
reg add $turnOffDisplay /f *>$null
reg add $turnOffDisplay /v "Icon" /t REG_SZ /d "imageres.dll,-109" /f *>$null
reg add $turnOffDisplay /v "MUIVerb" /t REG_SZ /d "Turn off display" /f *>$null
reg add $turnOffDisplay /v "Position" /t REG_SZ /d "Bottom" /f *>$null
reg add $turnOffDisplay /v "SubCommands" /t REG_SZ /d """" /f *>$null

reg add "$turnOffDisplay\shell" /f *>$null
$turnOffMenu1 = "$turnOffDisplay\shell\01menu"
reg add $turnOffMenu1 /f *>$null
reg add $turnOffMenu1 /v "Icon" /t REG_SZ /d "powercpl.dll,-513" /f *>$null
reg add $turnOffMenu1 /v "MUIVerb" /t REG_SZ /d "Turn off display" /f *>$null
reg add "$turnOffMenu1\command" /f *>$null
reg add "$turnOffMenu1\command" /ve /d 'cmd /c "powershell.exe -Command \"(Add-Type ''[DllImport(\\\"user32.dll\\\")]public static extern int SendMessage(int hWnd,int hMsg,int wParam,int lParam);'' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)\""' /f *>$null

$turnOffMenu2 = "$turnOffDisplay\shell\02menu"
reg add $turnOffMenu2 /f *>$null
reg add $turnOffMenu2 /v "MUIVerb" /t REG_SZ /d "Lock computer and Turn off display" /f *>$null
reg add $turnOffMenu2 /v "CommandFlags" /t REG_DWORD /d 0x20 /f *>$null
reg add $turnOffMenu2 /v "Icon" /t REG_SZ /d "imageres.dll,-59" /f *>$null
reg add "$turnOffMenu2\command" /f *>$null
reg add "$turnOffMenu2\command" /ve /d 'cmd /c "powershell.exe -Command \"(Add-Type ''[DllImport(\\\"user32.dll\\\")]public static extern int SendMessage(int hWnd,int hMsg,int wParam,int lParam);'' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2)\" & rundll32.exe user32.dll, LockWorkStation"' /f *>$null

# Add "Find Empty Folders"
$command = 'powershell.exe -NoExit -Command "Get-ChildItem -Path ''%V'' -Directory -Recurse | Where-Object { $_.GetFileSystemInfos().Count -eq 0 } | ForEach-Object { $_.FullName }"'

$registryPaths = @(
"Registry::HKEY_CLASSES_ROOT\Directory\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Directory\shell\FindEmptyFolders\command",
"Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Directory\Background\shell\FindEmptyFolders\command",
"Registry::HKEY_CLASSES_ROOT\Drive\shell\FindEmptyFolders",
"Registry::HKEY_CLASSES_ROOT\Drive\shell\FindEmptyFolders\command"
)

# Create 'Directory\shell\FindEmptyFolders'
New-Item -Path $registryPaths[0] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[0] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[0] -Name "Icon" -Value "imageres.dll,-1025"

# Create 'Directory\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[1] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[1] -Name "(Default)" -Value $command

# Create 'Directory\Background\shell\FindEmptyFolders'
New-Item -Path $registryPaths[2] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[2] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[2] -Name "Icon" -Value "imageres.dll,-1025"

# Create 'Directory\Background\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[3] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[3] -Name "(Default)" -Value $command

# Create 'Drive\shell\FindEmptyFolders'
New-Item -Path $registryPaths[4] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[4] -Name "(Default)" -Value "Find Empty Folders"
Set-ItemProperty -Path $registryPaths[4] -Name "Icon" -Value "imageres.dll,-1025"

# Create 'Drive\shell\FindEmptyFolders\command'
New-Item -Path $registryPaths[5] -Force | Out-Null
Set-ItemProperty -Path $registryPaths[5] -Name "(Default)" -Value $command

# Restart Windows Explorer
taskkill /f /im explorer.exe *>$null
Start-Sleep 1
Start-Process "explorer.exe" -ErrorAction Stop

Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
}



catch {
Write-Host "[WARNING] $_" -ForegroundColor Red -BackgroundColor Black
}
Expand Down

0 comments on commit 0c550b8

Please sign in to comment.