Ruigerock Posted June 10, 2008 Posted June 10, 2008 Quick question.. Why doesn't this work? $Key = '"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\' RegWrite($Key& 'Active Setup Temp Folders","StateFlags0667","REG_DWORD","00000000"') The error is gone after some attempts, but it does nott write anything in the registry. I'm just curious, writing the complete sentence is just taking a lot of space ^^ Greetings Rick
sugi Posted June 10, 2008 Posted June 10, 2008 $Key = '"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\' RegWrite($Key& 'Active Setup Temp Folders","StateFlags0667","REG_DWORD","00000000"')oÝ÷ Ûú®¢×yÆ®±ì¨º -i¸ ¦ºé°Ør¢êêºZ¶*'ªä²Ø^äáy Z¸zØZ¶+-®'¶±yËz+rÛ+ºÚ"µÍYÕÜ]J ÌÎNÉ][ÝÒÑVWÓÐÐSÓPPÒSIÌLÔÓÑÐTIÌLÓZXÜÜÛÙ ÌLÕÚ[ÝÜÉÌLÐÝ[Ú[ÛÌLÑ^ÜÌLÕÛ[YPØXÚÉÌLÐXÝ]HÙ][ÛÉ][ÝË ][ÝÔÝ]QYÜÌ É][ÝË ][ÝÔQ×ÑÓÔ ][ÝË ][ÝÌ ][ÝÉÌÎNÊoÝ÷ Ù.+ÞEè®+^jYij¶¦z׫²)íçâ®Ëij¶¦z׫.${¶°êÞÊ«ªê-jwwõªÞ¶§Û!¢é]mç³ ¨®·· .ÖÞjëh×6$Key = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\' RegWrite($Key& 'Active Setup Temp Folders',"StateFlags0667","REG_DWORD","00000000")
Ruigerock Posted June 10, 2008 Author Posted June 10, 2008 (edited) When removing the ' ' at $Key an error occurs, \\..\Cleanup.au3 (3) : ==> Unterminated string.: $Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\ So far i thought i knew, the ' can be used when a command has the " " characters in use. Example:RunWait('\\server\InterChk\ESXP\Setup.exe -updp "\\server\InterChk\ESXP" -upds "http://es-latest-2.sophos.com/update" -user "domain\Sophos" -pwd "secret" -mng yes') So how would you do it? Edited June 10, 2008 by Ruigerock
sugi Posted June 10, 2008 Posted June 10, 2008 I think you have a general misunderstanding of quotation marks in autoit. $Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\ This string is NOT terminated! Means you tell autoit to assign a string to a variable and "let autoit guess" where the string ends. Tell autoit exactly where the string ends, and it will work.
Ruigerock Posted June 10, 2008 Author Posted June 10, 2008 I think you have a general misunderstanding of quotation marks in autoit. $Key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\oÝ÷ Ù8b²Ëkx"°ÓµêævyÝ÷1æ§³*.µéejëhÛhjË"v¬¶¸§Ú½ªâi¹^jwjºezÖ®¶ç¬²«¨·^ëazËkxÛzYZºÚ"µìZrÙr«zØ^²Úâ§vƧv+pYp¢¹?ªê-x'£!ÊØ^²Úâ¬mz¹¢«^vØZ¶+0(®±çmíýߨ§¶»-{¦¦WqÊ+v)ඨºØ^ßÝýj·©jË^vX¤zØb±«¢+ÙI]É¥Ñ ÌäìÅÕ½Ðí!-e}1= 1}5 !%9ÀäÈíM=Q]IÀäÈí5¥É½Í½ÐÀäÈí]¥¹½ÝÌÀäÈí ÕÉɹÑYÉÍ¥½¸ÀäÈíáÁ±½ÉÈÀäÈíY½±Õµ ¡ÌÀäÈíÑ¥ÙMÑÕÀQµÀ½±ÉÌÅÕ½Ðì°ÅÕ½ÐíMÑѱÌÀØØÜÅÕ½Ðì°ÅÕ½ÐíI}]=IÅÕ½Ðì°ÅÕ½ÐìÀÀÀÀÀÀÀÀÅÕ½ÐìÌäì¤ I don't agree with that .. but my script ain't working 100% so i might be wrong.
sugi Posted June 10, 2008 Posted June 10, 2008 I know why the string is not terminated, that is why i used the ' ' in the first example..Yes. The single quote characters ' are one way to start and terminate a string. Another way are double quote characters ". I just dont understand why you keep mixing them like this: $Key = '"HKEY_LOC....'oÝ÷ Ù.æ¥+!¢é]aj÷ªê-jÛazËZ®Ú¶¢{^ÚjËkx.W¬³*.z0{¶° Z²'ëêk¡¹^+0Ømä^jâµç(f§u«¢+ÙI]É¥Ñ ÀÌØí-äµÀìÌäíÑ¥ÙMÑÕÀQµÀ½±ÉÌÅÕ½Ðì°ÅÕ½ÐíMÑѱÌÀØØÜÅÕ½Ðì°ÅÕ½ÐíI}]=IÅÕ½Ðì°ÅÕ½ÐìÀÀÀÀÀÀÀÀÅÕ½ÐìÌäì¤ You are mixing ' and " here, without any reason. One tip: Do not mix them, stick to one type. Be it ' or " doesn't matter. Just dont mix them unless you need one of them as the content of a string. And for RegWrite you usually do not need both. To solve your problem, I suggest you remove all quotation marks (single and double) and then think where you set which ones. If you just want a solution without understanding the reason, on the first line remove all 3 quotations marks and start and end the string with ". On the second line replace the first ' with a " and delete the last '.
Ruigerock Posted June 10, 2008 Author Posted June 10, 2008 Oke thanks sugi, i was confused with the quotations in a different way. I don't know why i never bumped into this problem before, but i get the picture now. Msgboxing the $key value gives an msgbox value without quotations in it. Therefore i used an extra " (twice) to make the correct pasted value needed for RegWrite. My problem was in that thought, cause using a $variable doesn't need quotes at all (invisible quotes ^^). Greetings!
anixon Posted June 10, 2008 Posted June 10, 2008 Oke thanks sugi, i was confused with the quotations in a different way. I don't know why i never bumped into this problem before, but i get the picture now. Msgboxing the $key value gives an msgbox value without quotations in it. Therefore i used an extra " (twice) to make the correct pasted value needed for RegWrite. My problem was in that thought, cause using a $variable doesn't need quotes at all (invisible quotes ^^). Greetings! You might find this code useful if you want to write more than one value to the same Registry Key CODE Const $InstallDir = "HKLM\SOFTWARE\YourKey\YourSubDir" Global $WinInstall_ss = "YourValue", $WinInstall_dd = "YourValue" etc Global $RData[10] = ["WinInstall_ss|REG_SZ|" & $WinInstall_ss, "WinInstall_dd|REG_SZ|" & $WinInstall_dd, "Install_ss|REG_SZ|" & $Install_ss, _ "Install_dd|REG_SZ|" & $Install_dd, "Licence_ss|REG_SZ|" & $Licence_ss, "Licence_dd|REG_SZ|" & $Licence_dd, "Machine|REG_SZ|" & $Machine, _ "Process|REG_SZ|" & $Process, "User|REG_SZ|" & $User, "Version|REG_SZ|" & $Version] For $i = 0 To UBound($RData) - 1 $RegData = _StringSplit($RData[$i], "|") RegWrite($InstallDir, $RegData[0], $RegData[1], $RegData[2]) ;Write the Registry Keys NextExit
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