Editing Registry with Batch or Reg File

By jhazard112 ·
We have found recently we need to change a key within the registry, but I do not want to have to do this with every machine that I touch, because thats alot of machines. Either or I was trying to find out how to change a key with a reg file or batch file either or doesnt really matter. What we are looking at is increasing the IRPStackSize because it is not large enough for us and keeps giving errors. I am not sure how we change it in a reg file, and we are also seeing that the DWORD value is not there in some cases at all. So, would I need to create two seperate reg/batch files? One to correct the IRP size and one to create the key if needed? I have never had to do this before so any help is much appreciated. I read the KB article on how to create reg files, but it did not make sense to me. I may need the dummie version of an explaination. Thanks again in advance.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by Brenton Keegan In reply to Editing Registry with Bat ...

I'd use vbscript.

the object has the methods you need. You can either use the "write" method to write the actual reg values or you can use the "run" method to run the regedit program and have it merge in a .reg file

your code should look something like this:

Dim WSHShell 'Variable declaration
Set WSHShell = WScript.CreateObject("WScript.Shell") 'set variable = to object

This bit will run a reg file
WshShell.Run "regedit /s " & """" & (reg file path) &""""

This bit will write a specified value:

WshShell.RegWrite (key location), (value), (type)

Things in the parenthesis are things you need to define.

Collapse -

GPO Update

by jhazard112 In reply to script

Would it be possible to push a GPO out updating this reg entry to ensure every machine got it on the network. That might make it a little easier.

Collapse -

The particular setting

by Brenton Keegan In reply to GPO Update

The particular change you want to make requires a registry change. I know, I've had to change that value network wide myself.

It requires a reg change in XP/2k3 environments anyway.

by the way, if you need to use a batch file and can't use a .vbs file for some reason. You'd issue this command:

regedit /s (reg file location)

you'll notice it's the same as the command because essentially that's what that method is doing.

Related Discussions

Related Forums