2
$Path = "Registry::HKEY_LOCAL_MACHINE\Software\ODBC\ODBC.INI\Test1\Test2\Test3\Test4"
New-Item -Path $Path

Getting below error

New-Item : The registry key at the specified path does not exist 

1 Answer 1

3

The form of the registry path is wrong. Use the following:

$Path = "HKLM:\Software\ODBC\ODBC.INI\Test1\Test2\Test3\Test4"
New-item -Path $Path -Force

As i see you are creating more than one sub dir, thats why you will need -Force switch. Using reg dirs in powerhsell

Hkey local machine = HKLM Hkey current user = HKCU Etc.

Sign up to request clarification or add additional context in comments.

2 Comments

We can use the both method in the registry path
-Force is creating the subfolders also. Thanks!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.