Reputation: 101
I'm a bit noob in PowerShell. I have to suppress a registry entry to remove the context menu option in explorer.exe "Upload to ShareX"
This value is located in : HKEY_CLASSES_ROOT\*\shell\ShareX
[It's also in directory but it have no effect when i delete the "directory" one]
So i tried to remove this item in PowerShell by using :
1st exemple : (not working)
New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT
set-location 'hkcr:\*\shell'
+ set-location 'hkcr:*\shell' + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidArgument : (:) [Set-Location], PSArgumentException + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.SetLocationCommand
2nd exemple : (not working)
remove-item -path Microsoft.PowerShell.Core\Registry::HKEY_CLASSES_ROOT\*\shell\ShareX -force -confirm:$false
or
remove-item -path 'Microsoft.PowerShell.Core\Registry::HKEY_CLASSES_ROOT\*\shell\ShareX' -force -confirm:$false
I can't get the * value :) PowerShell commands took it as "The Joker"
Can anyone help me please ?
Upvotes: 2
Views: 1866
Reputation: 10819
You need to escape the wildcard in your command. This is described in IDERA's PowerTip; if you quote the path with single quotes ' (usually on the key just to the left of ENTER), you prefix the wildcard with a single backtick ` (usually the key in the upper-left corner, immediately above TAB). If you use double quotes ", you may need to double the backtick.
Remove-Item -Path 'HKCR:\`*\Shell\ShareX' -Force -Confirm:$false
should do what you want.
Upvotes: 2