From 49cc35bccfb9431942f65c739c894c1b8fe5505f Mon Sep 17 00:00:00 2001 From: Jackbennett Date: Tue, 24 May 2016 15:44:54 +0100 Subject: [PATCH] Add unregister function, Add 'Background' Registry keys Adding the registry keys that match the c++ code in the cmder.exe call /REGISTER ALL and /UNREGISTER ALL. USER is untested. --- scripts/utils.ps1 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index cf33725..ead3064 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -87,6 +87,23 @@ function Register-Cmder(){ New-ItemProperty -Path "HKCR:\Directory\Shell\Cmder" -Force -Name "Icon" -Value `"$icon`" New-ItemProperty -Path "HKCR:\Directory\Shell\Cmder" -Force -Name "NoWorkingDirectory" New-Item -Path "HKCR:\Directory\Shell\Cmder\Command" -Force -Value "`"$PathToExe`" `"$Command`" " + + New-Item -Path "HKCR:\Directory\Background\Shell\Cmder" -Force -Value $MenuText + New-ItemProperty -Path "HKCR:\Directory\Background\Shell\Cmder" -Force -Name "Icon" -Value `"$icon`" + New-ItemProperty -Path "HKCR:\Directory\Background\Shell\Cmder" -Force -Name "NoWorkingDirectory" + New-Item -Path "HKCR:\Directory\Background\Shell\Cmder\Command" -Force -Value "`"$PathToExe`" `"$Command`" " + } +} + +function Unregister-Cmder{ + Begin + { + New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT + } + Process + { + Remove-Item -Path "HKCR:\Directory\Shell\Cmder" -Recurse + Remove-Item -Path "HKCR:\Directory\Background\Shell\Cmder" -Recurse } }