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.
Related
i want to automate something, but it only works if i manually accept the uac window, so i tried to change the registry value with this commads:
c:\Windows\System32\cmd.exe /k c:\Windows\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f
But it only works if i run the cmd as administrator. So again i need to accept the uac window to deactivate the uac windows...
Is there a good way to make this with a script ore something like that, or is there a bypass solution? (for automation puroses)
If you want to modify a registry hive without administrative privileges, you have to do it offline1.
To do so, you can boot into WinRE and then use regedit to modify your hives offline. You can also remove your hard disk and put it into another computer where you have administrative privileges and modify it there.
You can find an example here.
1 Offline in this case means, the hives are not mounted. Or in other words, the Windows installation is not running.
I am trying to run a registry file for each users when they first log in. I was looking at different options to add HKEY_CURRENT_USER but couldn't get a definitive answer. Need someone to direct me to the right direction.
So I have the following commands
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\foo.reg" /v "Version" /d "1" /t REG_SZ /f
add HKEY_CURRENT_USER\C:\mykit\foo.reg /v "EnableRPCEncryption" /d "1" /t REG_DWORD /f" /f
Ican execute them and but the reg_key doesn't run when I first login as a new user.
I am running windows 2012 server
Add the appropriate registry settings within HKU.Default using the same relative paths. Log in with a new user and check to see that the settings are present.
You can also create a Group Policy Object (GPO) that runs for all users and checks to see if the HKCU registry key is present and adds if necesary.
If you are not keen on GPO, you can write a batch file and place it in within the startup folder of the All Users Start Menu.
How disable and enable usb port via command prompt? or using batch script ? or using vb script in windows 7?
You can use batch which gives you a couple of options. You can edit the registry key to disable usb devices from being used
reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "4" /f
To enable change value to 3.
Or you can deny access to the files Usbstor.pnf and Usbstor.inf
cacls %windir%\Inf\Usbstor.pnf /d user
cacls %windir%\Inf\Usbstor.inf /d user
Where user is the user account that you want to deny access for.
To enable use
cacls %windir%\Inf\Usbstor.pnf /p user:R
cacls %windir%\Inf\Usbstor.inf /p user:R
Both commands will need admin rights.
Hope this helps
You can also have a look at devcon command. Available freely on microsoft site, for win7+ windows.
I have the same problem and I use a solution that takes the best of the two previous answers:
1º-We disable the functionality that allow us to detect new external storage devices:
reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "4" /f
2º-We remove all the drivers of USB devices installed on the PC (This will also eliminate the possibility of using keyboard and mouse, but only momentarily):
devcon.exe remove *USB*
3º- We re-scan the connected USB devices, so that Windows will automatically install the drivers of devices different than external storage (eg Mouse, keyboard ...), thus obtaining the desired result:
devcon.exe rescan
4º- If we want to re-allow the use of external storage devices in our PC, we must use the command:
reg add HKLM\SYSTEM\CurrentControlSet\Services\UsbStor /v "Start" /t REG_DWORD /d "3" /f
PD: Every command will need admin rights
I use USBDeview. See documentation and examples to use it. Easy and works fine
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?.
I'm deploying a small conversion tool on some systems, and want the users to be able to run it from the right click Open with menu. But I don't want to change the default program users have associated to this file type.
It is easy to associate a file extension/type to a program, but how to do it (programatically of course) without changing the default program?
Setting the following keys worked for me:
key HKLM/SOFTWARE/Microsoft/Windows/CurrentVersion/App Paths/<progname>: "" = <appPath>
key HKCR/Applications/<progname>/SupportedTypes: <fileExt> = ""
key HKCR/<fileExt>: "" = <progID>
key HKCR/<progID>/OpenWithList/<progName>
key HKCR/<fileExt>/OpenWithList/<progName>
key HKCR/SystemFileAssociations/<fileExt>/OpenWithList/<progName>
delete key and subkey at HKCU/SOFTWARE/Microsoft/Windows/CurrentVersion/Explorer/fileExts/<fileExt>
You can add scripts to the context menu (below Open with) by adding it in the windows registry:
Open regedit
Goto HKEY_CLASSES_ROOT\your_class\Shell
Add a new key and give it a name
Edit the (Default) value of this key and insert the text you want to show in the context menu
Add a new key named Command under your newly created key
Edit the (Default) value of this key and insert the command you want to execute
Enjoy!
In the "File Types" Windows Dialog you can click "Advanced" on your file type and there create a custom action tied to your application.
Possibly you can also find a way to do this in a programmatic manner, or at least create a .REG file with the equivalent registry options.
I have achieved the correct FILE ASSOCIATION using these cmd commands.
(just an example):
REG ADD "HKEY_CLASSES_ROOT\Applications\notepad++.exe\shell\open\command" /v # /t REG_SZ /d "\"C:\\Program Files\\Noteepad++\\notepad++.exe\" \"%1\"" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt" /v "Application" /t REG_SZ /d "notepad++.exe" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList" /v "g" /t REG_SZ /d "notepad++.exe" /f
assoc .txt=MyCustomType
ftype MyCustomType="C:\Program Files\Noteepad++\notepad++.exe" "%1"
(it's better to put them in .bat file)
here's a worked example for XP adding a command prompt option to folders. Create a .reg file
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt]
[HKEY_CLASSES_ROOT\Directory\shell\Command Prompt\command]
#="cmd.exe /k cd \"%1\""