I want to run a batch to remove a reg key from the start up.
I created a test key and I'm running the command below
Reg Delete "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run\Test" /F
But when I run the batch as Administrator I get the following error
"ERROR: The system was unable to find the specified registry key or value.
The key does exist in the reg but it will not appear in the command prompt.
Can any see what is going wrong here? or what command do I need to do to remove this reg key?
Replace HKEY_LOCAL_MACHINE with HKLM
Type reg /? at the command line for proper syntax.
Related
I'm trying to write a small batch script that is supposed to change some registry entries.
Now to do that from the command line one would use the reg add command. And when the specified registry key already exists it asks to overwrite the value.
For example reg add "HKCU\Control Panel\Colors" /v Background /t REG_SZ /d "120 0 0" yields Value Background exists, overwrite(Yes/No)? and only if I press y the command completes.
It does the same when the command is issued from a batch script. Since I would like the process to be automated and no further user input to be required I would like to remove the confirmation request. So is it possible to run this command non-interactively?
You can either use the /F flag as mentioned by Compo in the comments, or you can use a .reg file and start it in silent mode:
start regedit /s "C:\path\to\regfile.reg"
I am trying to add the following registry key through cmd. I am not able to get other users to be able to add this registry key using regedit.exe /s "Location\Project.reg".
[HKEY_CURRENT_USER\Software\Autodesk\Fabrication 2014\Configuration\1011-Shady-Grove]
"Path"="C:/Autodesk/Profiles/05MA/1011-Shady-Grove"
You are using the wrong tool. Regedit is a GUI tool. Yes you can use the /s switch, but fundamentally this is the wrong tool. Plus it is built with the highestAvailable option in the UAC manifest.
What you need is reg. Use it like this:
reg add "HKCU\Software\Autodesk\Fabrication 2014\Configuration\1011-Shady-Grove" /v Path /d C:/Autodesk/Profiles/05MA/1011-Shady-Grove
AFAIK, regedit will refuse to do anything if the user doesn't have administrative access, even if he has access to the registry keys.
Try the reg add command.
Hey! Could somebody help me to give a proper way to registry key value through cmd.
You can use the REG command to get info from the Registry through a batch file or at the command prompt.
Use REG QUERY /? for more information about the options available.
In the post-build Event, I have had the following command line,
REG ADD HKLM\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1
, which adds a DWORD type value under the registry key General.
I don't know what else I am missing here - the command line REG ADD just doesn't seem to work for me. After the installation, that key is still missing. If I run it alone using Command Prompt, it's all good though.
There is some issue with visual studio build events.
Even with admin privilege, it cannot register in HKLM.
instead if u try with HKEY_CURRENT_USER, it works great.
REG ADD HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\12.0\Common\General /v EnableLocalMachineVSTO /t REG_DWORD /d 1
how can i run to a specify path in regedit from cmd? I would like to add a new key to a specific service. Can someone help me? I would like to do this from a c# code, but first i am trying to do it from cmd. Thx
i would like to navigate from cmd to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Service and add in the Service service a new key with a value. i did write in cmd: regedit "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Service" add /v KeyName Parameters but i have an error saying that it can't load the file. why?
you can use
reg add "HKLM\SYSTEM\CurrentControlSet\services\Service" /v "KeyName" /d "Parameters" /f
Which would create a value (/v) named KeyName with data containing Parameters. the /f switch is used to override any confirmations and interruptions so the command can be executed without user input,omit for testing. additionaly,you can replace /v with /ve (value empty) and not specify a value name at all. this allows writting data (/d) to the default key value. also,if the path you intent to write to doesn't exist,the keys will be created without any warning.
for more information type reg /? in the command line
To add a Registry Entry from cmd using regedit, create a *.reg file containing the data you want to add. Simple example:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\TestKey]
"TestDWORD"=dword:00000123
and then execute this: regedit /s myreg.reg
This adds a Key (displayed like a folder in the regedit browser) named TestKey to HKEY_CURRENT_USER\Software. The TestKey Key contains a DWORD entry named "TestDWORD" that contains 123 in hex (291 in decimal)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\TestKey]
"TestDWORD"=dword:00000123
[HKEY_CURRENT_USER\Software\TestKey\SubKey]
"StringEntry"="StringValue"
This creates TestKey # HKEY_CURRENT_USER\Software plus a sub-key "SubKey" of TestKey with a String Entry (named "StringEntry") and value of "StringValue"
There's a simple way to find out how to create different kinds of entries: Use the regedit gui to create the desired entries, then mark the key and use the Menu File -> Export. The generated file will contain the key(s) and it's entries.
To create a Registry Entry in C#: http://msdn.microsoft.com/en-us/library/h5e7chcf.aspx
I don't know what "run to a specify path in regedit from cmd" means.
However, if you want set a registry key from a batch file, just create a .reg file by exporting it from Regedit, then run reg import [filename.reg] (where [filename.reg] is the name of the file you exported).
If you want to open up Regedit to show a certain key, see How to launch Windows' RegEdit with certain path?.