Create Registry Key / Folder


#1

Morning,

For the life of me I can't find a way to create a register folder. As in HKEY_LOCAL_MACHINE\SOFTWARE\SomeFolderHere

I just want to create a folder, no keys under it. Just a folder. Surely this is possible?

Rich


#2

Hi,
You can use execute resource and run reg OS command:

execute "Create registry folder" do
command "reg import D:\path_to_file\file.reg"
end

where you file.reg is for example contains:

Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\SomeFolderHere]

Regards,
Uri


#3

Hi Uri,

I'd honestly not thought of that, thinking there was another way. I will use this, thank you.

Rich


#4

You don't mention what you tried but what was wrong with:

registry_key 'HKEY_LOCAL_MACHINE\SOFTWARE\SomeFolderHere' do
  action :create
end