Tuesday, September 13, 2011

Editing Registry through a Batch file or Perl?

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\?br>


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.Editing Registry through a Batch file or Perl?
# UNTESTED CODE

# PROCEED AT YOUR OWN RISK

use Win32::TieRegistry(Delimiter =%26gt; '/');

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

$key .= '/';

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

$hash{'/NetworkAddress'}= ';0011whatever';;Editing Registry through a Batch file or Perl?
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.
  • kind of career path
  • msdn
  • No comments:

    Post a Comment