mirror of
https://github.com/cmderdev/cmder.git
synced 2025-01-11 00:39:08 +08:00
Merge pull request #962 from Jackbennett/PS-register
Register cmder in the context menu from powershell
This commit is contained in:
commit
7a37d37a4e
@ -79,7 +79,7 @@ function Register-Cmder(){
|
||||
)
|
||||
Begin
|
||||
{
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT > $null
|
||||
}
|
||||
Process
|
||||
{
|
||||
@ -87,6 +87,31 @@ 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`" "
|
||||
}
|
||||
End
|
||||
{
|
||||
Remove-PSDrive -Name HKCR
|
||||
}
|
||||
}
|
||||
|
||||
function Unregister-Cmder{
|
||||
Begin
|
||||
{
|
||||
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT > $null
|
||||
}
|
||||
Process
|
||||
{
|
||||
Remove-Item -Path "HKCR:\Directory\Shell\Cmder" -Recurse
|
||||
Remove-Item -Path "HKCR:\Directory\Background\Shell\Cmder" -Recurse
|
||||
}
|
||||
End
|
||||
{
|
||||
Remove-PSDrive -Name HKCR
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user