I am looking to make a batch file that will prompt for 2 values and then insert those 2 different values (both numbers) into 2 existing registry values.
A quick googling returned a lot of confusing scenarios. Is this possible?
Printable View
I am looking to make a batch file that will prompt for 2 values and then insert those 2 different values (both numbers) into 2 existing registry values.
A quick googling returned a lot of confusing scenarios. Is this possible?
Do you have to prompt for the number or can you just import the keys?
D
Slightly different answer to what you are asking for but.
1)If you have a Windows Server, (assuming you know the values) you can do this through Group Policy and it will be quicker/easier.
2)VBS or AutoIt would be better than batch file.
Something like this in AutoIt would get you started with an app that would prompt you for the values.
GUICreate("Registry Changer")
$RegHive1 = GUICtrlCreateInput("Reg Hive 1",50,50)
$Key1 = GUICtrlCreateInput("Key 1",50,65)
$RegHive2 = GUICtrlCreateInput("Reg Hive 2",50,80)
$Key1 = GUICtrlCreateInput("Key 1",50,95)
$Value_I_Set1 = GUICtrlCreateInput("What I want to set key 1 to.")
$Value_I_Set2 = GUICtrlCreateInput("What I want to set key 2 to")
RegWrite ( $RegHive1, $Key1 , $Value_I_Set1)
RegWrite ( $RegHive2, $Key2 , $Value_I_Set2)
While 1
$msg = guigetmsg()
Select
CASE
CASE
Thanks for the fast responses.
The 2 registry values I want to change I dont need input for, just their values.
So would I change the line "$RegHive1 = GUICtrlCreateInput("Reg Hive 1",50,50)" to the registry path? (i.e. "HKEY_LOCAL_MACHINE\SOFTWARE\TEST")
Check out these support articles Importing registry keys using Reg import
the way i do things is.
1. edit one machine manually
2. export the relevant edited registry settings
3. create a batch file which says4. add to group policy for machine startup scriptCode:reg import settings.reg
sit back and relax
Toby
That would be awesome glennda but my scenario is a little different.
I am burning an image and when I boot it for the first time I need to change to specific reg values.
The problem is I have to do this like 10 times a day. And the values are different at each site.
what type of image are you burning?
I am going to use clonezilla. I havent really messed with that part yet but a colleague of mine is going to help.
probably easiest way is to set up a bunch of correct reg files so site1.reg, site2.reg etc and then just create a dos menu using choice and then just regedit /s
something like this
Code:cls
@echo off
goto menu
:menu
echo.
echo Choice
echo.
echo 1 site 1
echo 2 site 2
echo 3 site 3
echo 4 site 4
echo 5 site 5
echo 6 Order a Cuppa
echo 7 Quit
echo.
:choice
set /P C=[1,2,3,4,5,6,7]?
if "%C%"=="7" goto quit
if "%C%"=="6" goto cuppa
if "%C%"=="5" goto 5
if "%C%"=="4" goto 4
if "%C%"=="3" goto 3
if "%C%"=="2" goto 2
if "%C%"=="1" goto 1
goto choice
:1
regedit /s "c:\site 1.reg"
goto quit
:2
regedit /s "c:\site 2.reg"
goto quit
:3
regedit /s "c:\site 3.reg"
goto quit
:4
regedit /s "c:\site 4.reg"
goto quit
:5
regedit /s "c:\site 5.reg"
goto quit
:cuppa
start \\server\NETLOGON\laptops\youwish.bat
goto quit
:quit
exit
:end
are the 2 different values going to be the same all the time ie
value 1 = 0
value 2 = 1
or do they always change randomly or what exactly ?