找回密码
 加入
搜索
查看: 1704|回复: 3

[AU3基础] 访问注册表子键的问题!

[复制链接]
发表于 2015-3-26 07:41:19 | 显示全部楼层 |阅读模式
无法返回子键下子键名称,@error=1,请教如何才能访问?
代码如下:
For $i = 1 To 50
        $var = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USBSTOR", $i)
        If @error <> 0 Then ExitLoop
        For $j=1 To 10
        $var2 = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USBSTOR\$var\", $j)
        If @error <> 0 Then
        MsgBox(4096,"错误值",@error)
        ExitLoop
        endif
        MsgBox(4096, "Value Name  #" & $j & " under in AutoIt3 key", $var2)
        Next
Next
发表于 2015-3-26 09:46:53 | 显示全部楼层
回复 1# msayxiaozhu


    "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USBSTOR\$var\"

這一段被 雙引號 框住 表示 是文字字串  所以 $var  不是變數 是文字  你的註冊表裡面有這個文字嗎??

所以應該改成  "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USBSTOR\"&$var&"\"
发表于 2015-3-26 18:06:52 | 显示全部楼层
和这个没关系

while 1
  if regread=‘’ then exstloop
$i +=1
wend
发表于 2015-3-27 22:06:28 | 显示全部楼层
#include <MsgBoxConstants.au3>

Local $sVar = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir")
MsgBox($MB_SYSTEMMODAL, "程序文件在:", $sVar)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-25 16:14 , Processed in 0.081100 second(s), 24 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表