New-Item recursive registry keys
command-line, powershell, registry, shell
Solution
I was just missing the `-force` parameter
New-Item hklm:software/classes/firefoxhtml/shell/edit/command -Force
Using `-Force` will also remove everything under the key if it already exists so a better option would be
if(!(Test-Path $path)){
New-Item $path -Force;
}
Problem
With PowerShell you can run a command like this ``` ni c:/foo/bar -type directory ``` and it will create `foo` and `bar` as necessary. However if you run ``` ni hklm:software/classes/firefoxhtml/shell/edit/command -type directory ``` all keys but the last must exist or an error will be generated. Can PowerShell generate the parent keys as needed?