joseff Posted May 2, 2008 Share Posted May 2, 2008 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 More sharing options...
Triblade Posted May 2, 2008 Share Posted May 2, 2008 I'm using Vista so maybe the results are different for you. I don't have the DhcpDomain and DhcpNameServer value's in the registry key you mentioned. U sure the variables are filled? (try with msgbox(0,"",$DhcpDomain) 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 More sharing options...
joseff Posted May 2, 2008 Author Share Posted May 2, 2008 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 More sharing options...
Triblade Posted May 2, 2008 Share Posted May 2, 2008 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 More sharing options...
joseff Posted May 2, 2008 Author Share Posted May 2, 2008 Thanks It was Human error Compiled and tested it on a win xp machine. Forgot to test it on the vista system (newb) I feel pretty stupid now. Thanks for the help:D Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now