I'm trying to create a new registry item in the [b]HKCR:\*\shell\ [/b]environment.
Sadly though, I can't get Powershell to accept the wildcard character as a normal character.
I've tried using the backtick and other escape characters, but it just doesn't seem to work.
What doesn't work:
New-Item -Path 'HKCR:\*\shell\takeownership\' -Name test –Force
Normally you can escape those wildcard-supporting paths by putting the special characters in square brackets, but in my testing, that didn't seem to work. Maybe New-Item needs a -LiteralPath parameter.
In the meantime, you might just need to work around this. If you want to use the registry provider and New-Item, you could split the path and use Set-Location -LiteralPath, or maybe you could resort to calling the .NET methods directly. Something like this: