bj17209 发表于 2010-7-2 10:14:45

请教注册表生效问题!代码附上!

请教注册表生效问题!代码附上!
为什么修改了注册表不能生效啊!请哪位大哥帮忙看看啊!
60config.ini


服务器IP=192.168.0.252
映射磁盘=O:
映射路径=\\192.168.0.252\ie60$

au3代码

#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_Icon=png-0094.ico
#AutoIt3Wrapper_Outfile=60tian.exe
#AutoIt3Wrapper_Res_Comment=60天记录保存器
#AutoIt3Wrapper_Res_Description=60天记录保存器
#AutoIt3Wrapper_Res_Fileversion=1.0.0.2
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=y
#AutoIt3Wrapper_Res_LegalCopyright=网络三毛QQ23371862
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <Process.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Misc.au3> ;导入一个AU3自带文件,主要用其防止重复运行程序的函数

_Singleton("TheNameOfMy") ;这个函数就是用来检测是否有相同程序在运行如果有则退出,就是只运行一次
Break(0) ;禁止退出!
Send("{NUMLOCK on}")
TraySetState(4)
;日志路径

If FileExists(@ScriptDir & "\60config.ini") Then
Else
        TrayTip("提示消息", "ie60天记录保存配置文件丢失!", 1)
        Sleep(3000)
        Qexit()
EndIf

;$time = IniRead(@ScriptDir & "\客户端配置.ini", "延时设置", "延时", "")
;Sleep($time)

$server1_ip = IniRead(@ScriptDir & "\60config.ini", "config", "服务器IP", "")
$var = Ping($server1_ip, 10)
If $var Then; also possible: If @error = 0 Then ...
        ;MsgBox(0, "Status", "测试:" & $var)
        server1()
        Exit
Else
        TrayTip("提示消息", "ie60天记录保存服务器无法链接", 3)
        Sleep(3000)
        Exit
EndIf
Func server1()
        $I_server1 = @ScriptDir & "\60config.ini"
        $I_files = IniRead($I_server1, "config", "映射磁盘", "")
        $I_fadmin = IniRead($I_server1, "config", "映射路径", "")
        ;映射驱动器
        DriveMapAdd($I_files, $I_fadmin)
                ;60天
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Url History", "DaysToKeep", "REG_DWORD", "0x0000003c")

        ;60天记录路径修改
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "Cookies", "REG_SZ", $I_files & " \%COMPUTERNAME%\Cookies")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders", "History", "REG_SZ", $I_files & "\%COMPUTERNAME%\History")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "Cookies", "REG_SZ", $I_files & "\%COMPUTERNAME%\Cookies")
        RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders", "History", "REG_SZ", $I_files & "\%COMPUTERNAME%\History")
        DllCall("user32.dll", "int", "SendMessageTimeout", "hwnd", 65535, "int", 26, "int", 0, "int", 0, "int", 0, "int", 1000, "str", "dwResult")
        Run("RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters")
        Run(@ComSpec & " /c gpupdate /force", "", 0)

EndFunc   ;==>server1
Func Qexit()
        Exit
EndFunc   ;==>Qexit
Func Terminate()

        Exit 0
EndFunc   ;==>Terminate

ferelove 发表于 2010-7-2 10:21:52

传送门,看过一位高手写的。《刷新组策略、注册表》Dim $Return
$Return = DllCAll("Userenv.dll","int","RefreshPolicyEx","int",1,"int",1)
If IsArray($Return) Then
      If $Return <> 0 Then
                        MsgBox(0,"","操作成功.返回值:" & $Return)
                Else
                        MsgBox(0,"","操作失败.返回值:" & $Return)
                EndIf
EndIf
Exit

ferelove 发表于 2010-7-2 10:24:39

再传送一个,三恨大侠博客上的http://www.lunhui.net.cn/article.asp?id=202

bj17209 发表于 2010-7-2 14:26:12

各位大哥,还是不行啊!!帮我测试下代码啊1

netegg 发表于 2010-7-2 21:24:45

envupdate()
页: [1]
查看完整版本: 请教注册表生效问题!代码附上!