Question:
Editing Registry through a Batch file or Perl?
Mike w
2007-10-01 14:38:55 UTC
I would like to be able to add/edit/remove registry entries from a batch file or a perl script.

Basiclly im trying to add an entry to change my mac address so say its in this folder:
HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Control\Class\
{4D36E972-E325-11CE-BFC1-08002BE10318\0001}

and i need to add this registry entry
Name: = NetworkAddress
Type: = REG_SZ
Value: 001122334455

How would i go about doing this? commands or lines of code would be helpful thnx.
Three answers:
martinthurn
2007-10-01 19:31:07 UTC
# UNTESTED CODE

# PROCEED AT YOUR OWN RISK

use Win32::TieRegistry(Delimiter => '/');

my $key = join('/', qw( LMachine SYSTEM CurrentControlSet Control Clas... {4Dwhatever} ));

$key .= '/';

my $hash = $Registry->{$key} or die "Can't find the registry key: $^E\n";

$hash{'/NetworkAddress'}= "0011whatever";
Kevin
2007-10-01 14:45:28 UTC
Why edit the registry at all is it a static ip address yoru dealing with?



You can make a batch file of say:



ipconfig /release

ipconfig /renew

exit



Which will give you a new address on your network card from your routers built in DHCP server. That will usually get you back on a dropped or locked internet connection.
?
2016-05-18 08:30:53 UTC
I have but would definitely for a slice of that homemade chocolate cake. I had done that for very short distances but it was too hot for the snakes & no bugs either.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...