Banjaxt
Banjaxt

Reputation: 59

Creating a new registry folder with a space AND a forward slash in the folder name

I'm trying to create a new registry folder but the path I was to create contains a space and I'm not sure how to escape this to create the path correctly.

The path I'm trying to create is:

HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 64/128 (with a single folder called 'RC4(space)64/128' as the end of the path)

As you can see there is a space between RC4 and 64/128 (and also a slash between 64 and 128).

I have tried the following in powershell:

md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 64$([char]0x2215)128"

and

md "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 64\/128"

But neither of these work.

The issue is that I need BOTH a space AND a forward slash in the resulting registry key folder name, as described above.

Upvotes: 3

Views: 2843

Answers (2)

daddmac
daddmac

Reputation: 11

([Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine, $env:COMPUTERNAME)).CreateSubKey('SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Ciphers\RC4 64/128')

Ref: Reddit: How do you escape in powershell

Upvotes: 1

rrirower
rrirower

Reputation: 4590

This works for me:

New-Item -Path "HKCU:\Software\My Software\My Version" -Name "Sample key" -Force

enter image description here

Upvotes: 0

Related Questions