Task: there is a certain registry key value that needs to be set on several computers. At the same time, using group policies for this is out of scope for this note.
1) Create a computers.txt file (you can name it whatever you like).
2) Into this file put the IP addresses of the computers or their network names - one per line.
3) Create a bat file with the following contents:
FOR /F "Tokens=*" %%A IN (computers.txt) DO reg.exe ADD "\\%%A\HKLM\Software\MySoftware" /v MyKeyName /d REG_DWORD /v 1 /f
Here:
- computers.txt : The file we created
- ADD : Command for the REG.EXE console registry management utility
- "\\..." : Path to the desired registry key. The %%A variable will hold the computer name for each line of the computers.txt file
- /v MyKeyName : Name of the registry key
- /d REG_WORD : Type of the registry key
- /v 1 : Value assigned to this key
- /f : Don't prompt for confirmation to overwrite existing values
.
PS. If you're running this command ("FOR...") from the command line (not from a bat file), replace %%A with %A.
Comments