Get IT Solutions

How to do IT
Menu
  • Home
  • SCCM 2012
    • Deploy Packages
    • Troubleshooting errors SCCM 2012
  • Windows
    • Applications Silent Install
    • Windows Tools
    • Windows Error
    • Script
    • Exchange Server
    • Troubleshooting Office
    • Applications Errors
  • Database
    • SQL Server
    • MySQL
    • Oracle
  • Cybersecurity
  • Other
  • Reviews

How to add registry key & values with CMD | PowerShell | Batch

The registry is the place where most of the applications store the settings but not only. Used also from the windows system to store important settings in order to be available to operate. We will cover a series of articles to explain how can be added, edited, and deleted the registry keys and values. This will be done using the Windows command prompt but not only. Will try to use also the PowerShell and GPO. In the end, you will be available to change them individually or over the network using batch. In this part, we will cover how to add registry key and values with command line, PowerShell, and batch file.

Check Also:

How to Edit Registry Key/value

How to Delete Registry Key/value

 

How to add registry key and value with CMD:

Below is the default commands line to add new registry key and  “NewTestKey” on path “HKEY_CURRENT_USER\Software\” – To run it:

  1. Start
  2. Search “CMD”
  3. Run as Administrator
  4. Execute Below Command
reg add HKEY_CURRENT_USER\Software\NewTestKey
Add Registry Key CMD

Add Registry Key CMD

Below is the default command to add new registry value entry “TestValue” of type “DWORD (32-bit)” on path “HKEY_CURRENT_USER\Software\NewTestKey\” and add the value of “1”. To run it:

  1. Start
  2. Search “CMD”
  3. Run as Administrator
  4. Execute Below Command

Customized:

reg  add  HKEY_CURRENT_USER\Software\NewTestKey\ /v  TestValue /t  REG_DWORD /d  1

Default Command:

Reg Add Regkey /v RegValue /t RegType /d data

Command Description:

  • Regkey – Path where the new value should be added.
  • RegValue – Name of the value that should be added
  • /t – Type of the value (REG_SZ, REG_DWORD, REG_BINARY)
  • /d Data – Specifies the data for the new entry in the registry.
Add Registry Value CMD

Add Registry Value CMD

 

How to add Registry key and value with PowerShell:

Below is the PowerShell default command to add new registry key “NewTestKey” on path “HKEY_CURRENT_USER\Software\” – To run it:

  1. Start
  2. Search PowerShell
  3. Run as Administrator
  4. Execute Below Command
# Set the location to the registry
Set-Location -Path 'HKCU:\Software\'
# Create a new Key
Get-Item -Path 'HKCU:\Software\' | New-Item -Name 'NewTestKey' –Force
Add Registry Key Powershell

Add Registry Key Powershell

 

Below is the PowerShell default command to add new registry value entry “TestValue” of type “DWORD (32-bit)” on the path “HKEY_CURRENT_USER\Software\NewTestKey\” and add the value of “1” – To run it:

  1. Start
  2. Search PowerShell
  3. Run as Administrator
  4. Execute Below Command
# Create new items with values
New-ItemProperty -Path 'HKCU:\Software\NewTestKey' -Name  'TestValue' -Value '1' -PropertyType 'DWORD' –Force
# Get out of the Registry
Pop-Location
Add Registry Value PowerShell

Add Registry Value PowerShell

 

How to add Registry key and value on a remote computer:

Below is the command to add registry key on a remote computer. To run it:

  1. Start
  2. Search “CMD”
  3. Run as Administrator
  4. Execute Below Command
REG ADD \\ComputerName\HKCU\Software\NewTestKey

Below is the command to add registry value on a remote computer. To run it:

  1. Start
  2. Search “CMD”
  3. Run as Administrator
  4. Execute Below Command
REG ADD \\ComputerName\HKCU\Software\NewTestKey /v TestValue /t REG_DWORD /d 1

 

How to add registry key and value with batch file:

The same commands used above to add the registry key from the command prompt can be integrated on the batch file. The commands can be used on the existing batch along with other commands or on the new batch file. To create a new batch file:

  1. Open a notepad files
  2. Write the below command
@echo off

reg add HKEY_CURRENT_USER\Software\NewTestKey

reg  add  HKEY_CURRENT_USER\Software\NewTestKey\ /v  TestValue /t  REG_DWORD /d  1
  1. Save it as regedit.bat
  2. Run it with DoubleClick and the command will be executed.

The bat files used mostly when you want to spread it over the network using GPO or SCCM

 

How to add registry key and value with regedit file (.reg)

You can add registry key and value by using .reg file. This file structure can be found by exporting certain keys from the regedit interface by right-clicking on it and the export option. To create it from the screech:

  1. Open a notepad file
  2. Copy and paste the below command
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\NewTestKey2]
  1. Save it at addkey.reg

 

This command with creates NewTestKey2 key if does not exist. To add registry value copy and paste the following command:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\NewTestKey2]
@="HKEY_CURRENT_USER\\Software"
"TestValue"=dword:00000001

The command with creating new value “TestValue” of type dword with value “1”. To execute .reg files, double-click it and after typing to the confirmation yes the changes with be done.

Add Registry Key with regedit

Add Registry Key with regedit

Conclusion:

Those are the methods to add registry key and values using command prompt, PowerShell, and batch files. Follow us for the next articles where we will explain the methods to edit and delete keys and values from the registry

Share
Tweet
Google+
Pinterest
Linkedin
Stumble
Email
Prev Article
Next Article

Related Articles

Cloning HDD using command prompt
Cloning HDD using command prompt means to have again on …

Cloning HDD using command prompt

How to create PowerShell scheduled task
To create PowerShell scheduled task it is convenient since you …

How to create PowerShell scheduled task

Best Computers & Laptops

Best Computer for Cyber Security – Laptop and Desktop
Best Computer for Cyber Security
Hey, are you seeking the best computer for cyber security? Well, we must say you have come to the right place to find your answer and guidance. There are a plethora of products out there for you to pick from ...
Read More
Best Computer for Microsoft Office & Excel – Laptop and Desktop
Best Computer for Microsoft Office & Excel
Are you finding the Best Computer for Microsoft Office and Excel? In modern days, the best laptop or desktop set is the one which is both portable, has good looks and offers the smoothest performance. Microsoft Office is a package ...
Read More
Best Computer for Hacking – Laptop and Desktop Selection
Best computer for Hacking
When it comes to hacking, either laptop or desktop, choosing the best computer for hacking would be an exhilarating job. There are many specifications to be considered for hacking ...
Read More

SQL Server Tips

FIX sqlstate 42000 – mysql error 1064 – you have an error in your sql syntax
Sqlstate 42000 Is a general code that come together with other number. Most often comes with the code 1064 and ...
Read More
The execute permission was denied on the object – SQL Server Error
The execute permission was denied on the object
The following article will handle “the execute permission was denied on the object” error appears on SQL Server. This error ...
Read More
How to Read Data from LDF file in SQL Server – A Complete Guide
Read LDF File
Hello Everyone, Today we are going to address the most popular query of SQL users, how to read data from ...
Read More

Search

We are on:

Get FREE SPACE for your PC

3 Method to Delete Temp Files in Windows 7/10 including vbs script

In this post we will explain how to delete temp files windows 7 using three different methods including vbs script ...
Read More

Fastest way to delete hiberfil sys from windows 10/8/7 and XP – CMD

In this article we will explain how to remove or delete hiberfil sys from Windows 10/8/7 and XP . If you does ...
Read More

Learn How to Silent Install Applications

Silent Install Adobe Flash Player
In this tutorial will explain how to silent install adobe flash player 25, Msi and Exe version. How to disable auto update and uninstall older ...
Read More
Java Silent Install and Uninstall Older Version – Deploy Package MSI
This tutorial will explain how to silent install Java MSI/EXE version and disable auto-update. The command line will also uninstall the ...
Read More
Silent Install Adobe Shockwave Player 12 and disable update
In this tutorial will explain how to silent install Adobe Shockwave Player 12 msi and disable auto update. The command will uninstall older ...
Read More
Silent Install Google Chrome MSI, Silent Uninstall and Disable Auto Update
This tutorial will explain how to silent install Google Chrome MSI and disable auto update. The command will uninstall older version of ...
Read More
Silent Install Adobe Reader 11 and DC – msi and exe – disable update
In this tutorial will explain how to silent install Adobe Reader version 11 and DC. We will user both version "msi" ...
Read More
Silent Install Mozilla Firefox msi and exe file – Including Silent Uninstallation
This tutorial will explain how to silent install Mozilla Firefox. We will use MSI and EXE files to perform a silent ...
Read More
Skype Silent Install Msi and disable updates
In this tutorial will explain how to silent install skype  and disable auto update. The command will uninstall older version of Skype and ...
Read More
Filezilla Silent Install msi and exe version
Filezilla silent install tutorial will explain how to perform a silent installation of application. We will explain methods, silent install ...
Read More
Silent install VLC Media Player
In this tutorial will explain how to silent install VLC Media Player. We will explain both methods for exe and ...
Read More
Notepad++ silent install exe and msi version – Command Line
Notepad++ silent install is the new article from a series of silent installations. Notepad++ as free software has two main ...
Read More

Batch File Solutions

How to list files in cmd – Command Prompt – Windows 10
Whenever you want to search and make a list of all files on a specific folder, you used the windows ...
Read More
Batch rename multiple files in folder – CMD script – Bulk Method – Win 10
The following article will teach how to rename multiple files in a folder with the bulk method using Command Line ...
Read More
Batch script rename file using Command Line (CMD) & PowerShell – Windows 10
The following article will use the “rename” or “ren” command to rename the file using a command prompt. Also, we ...
Read More
Change extension of multiple files at once – CMD batch file
The following article will teach the methods to change the extension of multiple files at once using command prompt and ...
Read More
How to delete registry key with command line | PowerShell | Batch
The following article is the third of series about registry and working on it through command line (CMD) and PowerShell ...
Read More
How to add registry key & values with CMD | PowerShell | Batch
The registry is the place where most of the applications store the settings but not only. Used also from the ...
Read More
Unmap Network Drive CMD – (Batch file) – net use delete command
After we posted the methods to map network drive using cmd commands we come this time with the method to ...
Read More
Map Network Drive cmd (batch file) – net use user password
This article will focus on another way to map a network drive on your computer instead of from the explorer ...
Read More
How to Find Large Files on Windows 7 & 10 – CMD Forfiles Command
If the capacity of your hard drive is running low, it is time to clean off some files and to ...
Read More
CMD Script to check disk space on windows and multiple remote servers
The following article will provide you script to check disk space. The Script monitor space on windows and multiple remote ...
Read More

Get IT Solutions

How to do IT

About Us

Get IT Solutions is a personal blog, which is managed to guide people for various topic.

Second Menu

  • Donate
  • About Us
  • Contact Us
  • Privacy Policy

What Will You Find

Automation is our area of writing where are included scripts, batch and various tips to automate your daily job.
Copyright © 2025 Get IT Solutions