0
votes

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 ?

1
You need to escape the wildcard. This IDERA PowerTip may help. - Jeff Zeitlin
I have no success in my tests :( can you show me please the way to use escape wildcards with this command : {remove-item -path 'Microsoft.PowerShell.Core\Registry::HKEY_CLASSES_ROOT\''*\shell\ShareX' -force -confirm:$false} please ? - Amiga1200
Remove-Item -Path 'HKCR:\`*\Shell\ShareX' -force -confirm:$false - note carefully the single quote around the pathname, and the backtick immediately before the wildcard asterisk. - Jeff Zeitlin
You are a king ! it works ! thanks a lot ! - Amiga1200

1 Answers

0
votes

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.