Jump to content

Recommended Posts

Posted

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?

Posted (edited)

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

Edited by superfletch
Add stuff + spelling
Posted

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")

Posted

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.

Posted

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

 

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

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



  • 9 When would you like EduGeek EDIT 2025 to be held?

    1. 1. Select a time period you can attend


      • I can make it in June\July
      • I can make it in August\Sept
      • Other time period. Please comment in the thread what works for you
      • Either time

×
×
  • Create New...