38 lines
1.0 KiB
PowerShell
38 lines
1.0 KiB
PowerShell
[CmdletBinding()]
|
|
param (
|
|
[Parameter()]
|
|
[switch]
|
|
$Disable
|
|
)
|
|
|
|
# GUID and Registry Path
|
|
$guid = "{86CA1AA0-34AA-4E8B-A509-50C905BAE2A2}"
|
|
$RegPath_ContextMenu = "HKCU:\Software\Classes\CLSID\"
|
|
$FullContextMenuStatus = "disabled"
|
|
|
|
function EnableFullContextMenu {
|
|
# Create the GUID key
|
|
New-Item -Path $RegPath_ContextMenu -Name $guid -Force | Out-Null
|
|
|
|
# Create the InprocServer32 key
|
|
New-Item -Path $RegPath_ContextMenu$guid -Name InprocServer32 -Value "" -Force | Out-Null
|
|
}
|
|
|
|
function DisableFullContextMenu {
|
|
# Delete the Context Menu overrides
|
|
Remove-Item -Path $RegPath_ContextMenu -Recurse -Force -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
if ($Disable) {
|
|
DisableFullContextMenu
|
|
$FullContextMenuStatus = "disabled"
|
|
}
|
|
else {
|
|
EnableFullContextMenu
|
|
$FullContextMenuStatus = "enabled"
|
|
}
|
|
|
|
Write-Output "Full Context Menu has been $FullContextMenuStatus. Restarting File Explorer to see the changes..."
|
|
|
|
Stop-Process -Name explorer -Force
|
|
Start-Process -FilePath "C:\Windows\explorer.exe" |