3

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.

Banjaxt
  • 61
  • 4
  • 1
    Possible duplicate of [Creating a registry key with path components via PowerShell](http://stackoverflow.com/questions/16149175/creating-a-registry-key-with-path-components-via-powershell) – Zombo Oct 15 '15 at 01:23

2 Answers2

1
([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

Techie
  • 1,491
  • 3
  • 18
  • 24
daddmac
  • 11
  • 1
0

This works for me:

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

enter image description here

rrirower
  • 4,338
  • 4
  • 27
  • 45
  • That creates a '128' subfolder within an 'RC4 64' folder for me. I'm looking to create a subfolder called 'RC4 64/128' under 'Ciphers' :( Thanks though! – Banjaxt Oct 14 '15 at 16:01
  • Don't think that was me, but your solution didn't work so I reworded the question to show I needed both a space and a slash in the folder name. I had to resort to calling a reg file as a hacky work around but if you know a way of doing this that would be very helpful :) – Banjaxt Oct 15 '15 at 13:23