Jump to content

Regwrite With $var inside?


Recommended Posts

Hello all :)

I want to read two registry entries, and then write them to a new entry.

U can see from the code that i want to copy the dhcp and dns server adresses to the IE Secure Location.

The problem is that when i use "$variables" in "" it stop working as a $variabel.

And if i don''t use the "" the regwrite command don''t read the $variable.

Any tips?

$DhcpDomain = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters", "DhcpDomain")
$DhcpNameServer = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\Tcpip\Parameters", "DhcpNameServer")



RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range10", ":range", "REG_SZ",  $DhcpDomain)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range10", "http", "REG_DWORD", "00000002")

RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range11", ":range", "REG_SZ", $DhcpNameServer)
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Ranges\Range11", "http", "REG_DWORD", "00000002")
Link to comment
Share on other sites

Im sure the variabled are filled.

The msgbox givs me the correct information.

The computer is connected by wifi. maybe thats the diffrence.

The computer runs win vista.

I only need to know if its possible and how to use $varibels in the regwrite?

Link to comment
Share on other sites

It is supposed to be possible.

As far as I can see, you use it as it is supposed to be used. a.k.a. correctly.

Try to get the outcome of the RegWrite and check with:

Failure: Returns 0 if error writing registry key or value.

@error can be set to following values :

1 if unable to open requested key

2 if unable to open requested main key

3 if unable to remote connect to the registry

-1 if unable to open requested value

-2 if value type not supported

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...