Jump to content

Creating registry entires using REG


Recommended Posts

I have a .reg file that adds Control Panel to My Computer. It's the usual entry from the tweaks:

Windows Registry Editor Version 5.00
;=======================================================================
; My Computer Right Click
;=======================================================================

;-----
;----- Adds Control Panel to right click of MY Computer
;-----
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Control Panel\command]
@="rundll32.exe shell32.dll,Control_RunDLL"

I want to add this using Window XP's built-in "REG ADD" command, but I cannot find a syntax that works.

If I dump a working example with REG QUERY I get this:


! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\shell\Control Panel\command
<NO NAME> REG_SZ rundll32.exe shell32.dll,Control_RunDLL

But my various non-working attempts (in a VM) show an extra REG_SZ after the final RunDLL.

Anyone know the correct sequence of commands that I should use?

BTW: I'm doing this because I want to be able to apply tweaks individually to other machines, not just when I want to perform an unattended install. I want all the tweaks in one place (WPI's config.js) rather than in umpteen itty-bitty files.

Link to comment
Share on other sites


Here you go, I've made it in such a way as to hopefully help you understand it better.

@Echo off
Setlocal Enableextensions

:: Create a variable for required key
Set "Key=HKLM\SOFTWARE\Classes"
Set "Key=%Key%\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}"
Set "Key=%Key%\shell\Control Panel\command"

::Create a variable for the command you wish to run
Set "Cpl=rundll32 shell32,Control_RunDLL"

::Add key to registry using Reg.exe
Reg add "%Key%" /ve /d "%Cpl%" /f>Nul

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...