beb7089 Posted February 22, 2010 Share Posted February 22, 2010 My script was complied using the 32bit complier and work fine on 32 bit machines but fails to work on 64 bit. Trying to run script on Windows 7 32 & 64bit machines. $var = RegRead('HKLM\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server') If @error = "0" Then RegWrite('HKLM\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server', 'Reg_sz', 'HQSQLDEV01') EndIf Exit Link to comment Share on other sites More sharing options...
water Posted February 22, 2010 Share Posted February 22, 2010 Doesn't it run at all (exe crashes) or doesn't it do what you want? Please have a look at the help file (regread function). There is some info about running AutoIt on 64-bit Function RegRead: ... When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64. ..." My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
dani Posted February 22, 2010 Share Posted February 22, 2010 (edited) It's not that easy I stand corrected, it is that easy for at least HKLM and maybe more (just add '64' => HKLM64) . I'm talking about Windows 7 x64 btw. For example, the 64bit version of HKEY_CLASSES_ROOT = HKEY_CLASSES_ROOT\Wow6432Node\. Same for HKEY_LOCAL_MACHINE\Software => HKEY_LOCAL_MACHINE\Software\Wow6432Node. These are, however, only used by true 64bit programs, so not by 32bit versions. If ODBC is 32 bit it would be located at the same location, and your script probably works for me (Win7 64 bit). I don't know why the compiled version wouldn't work. A script I compiled on my 64 bit machine (as 32 bit .exes) works on 32bit windows versions. It also uses RegRead, only once though. Edited February 24, 2010 by d4ni Link to comment Share on other sites More sharing options...
beb7089 Posted February 22, 2010 Author Share Posted February 22, 2010 Doesn't it run at all (exe crashes) or doesn't it do what you want?Please have a look at the help file (regread function). There is some info about running AutoIt on 64-bitFunction RegRead:... When running on 64-bit Windows if you want to read a value specific to the 64-bit environment you have to suffix the HK... with 64 i.e. HKLM64. ..."It doesnt crash or anything. It appears to run but when you check the registry the change has not been made.I will check out RegRead. Most everything I do is for 32bit but in this case I have about 10 64bit machines that need updating. Link to comment Share on other sites More sharing options...
dani Posted February 22, 2010 Share Posted February 22, 2010 (edited) Do some more debugging. See if it actually reads the right value, if it executes the body of the If statement, etc. Maybe it has something to do with administrator privileges, too. Edited February 22, 2010 by d4ni Link to comment Share on other sites More sharing options...
beb7089 Posted February 22, 2010 Author Share Posted February 22, 2010 (edited) Do some more debugging. See if it actually reads the right value, if it executes the body of the If statement, etc. Maybe it has something to do with administrator privileges, too. Found my issue. RegRead and RegWrite required HKLM64 or HKLM depending on the OS and it must run as Administrator. Thank you d4ni and water. Here is my new script. If @OSArch = "X64" Then $key = "HKLM64" Else $key = "HKLM" EndIf $var = RegRead($key & '\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server') If @error = "0" Then RegWrite($key & '\SOFTWARE\ODBC\ODBC.INI\VC Test', 'Server', 'Reg_sz', 'HQSQLDEV01') EndIf Exit Edited February 22, 2010 by beb7089 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