如果主键不多的话,可以直接用 AutoIt 的 RegWrite() 函数
例如 AutoIt3 自动安装脚本里的部分代码:
;==================== 全面备份注册表 =========================
If RegRead('Hkcr\AutoIt3Script\Shell','') <> '' Then
RegWrite('Hkcr\AutoIt3Script\Shell','','Reg_Sz','Run')
EndIf
RegWrite('Hkcu\SOFTWARE\AutoIt v3\AutoIt', 'Include','Reg_Sz',@ScriptDir & '\UserInclude')
RegWrite('Hkcu\Software\Sysinternals\Process Explorer','EulaAccepted','Reg_Dword',1)
RegDelete('Hkcr\.au3')
RegDelete('hklm\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\AutoIt v3')
RegWrite('Hkcr\.Au3','','Reg_Sz','AutoIt3Script')
RegWrite('Hkcr\.Au3','PerceivedType','Reg_Sz','Text')
RegWrite('Hkcr\.Au3','PersistentHandler','Reg_Sz','{5e941d80-bf96-11cd-b579-08002b30bfeb}')
RegWrite('Hkcr\.Au3\ShellNew','FileName','Reg_Sz',@WindowsDir & '\ShellNew\Template.Au3')
RegWrite('Hkcr\AutoIt3Script','','Reg_Sz','AutoIt3Script')
RegWrite('Hkcr\AutoIt3Script\DefAultIcon','','Reg_Sz',@WorkingDir & '\Aut2Exe\Icons\FileType1.Ico')
RegWrite('Hkcr\AutoIt3Script\Shell','','Reg_Sz','Run')
RegWrite('Hkcr\AutoIt3Script\Shell\Run','','Reg_Sz','&R. 运行脚本')
RegWrite('Hkcr\AutoIt3Script\Shell\Run\Command','','Reg_Sz','"' & @WorkingDir & '\AutoIt3.eXe" "%1" "%*"')
RegWrite('Hkcr\AutoIt3Script\Shell\WinInfo','','Reg_Sz','&W. 窗口信息工具')
RegWrite('Hkcr\AutoIt3Script\Shell\WinInfo\Command','','Reg_Sz',@WorkingDir & '\Au3Info.eXe')
RegWrite('Hkcr\AutoIt3Script\Shell\Compile','','Reg_Sz','&A. 编译脚本(进度栏)')
RegWrite('Hkcr\AutoIt3Script\Shell\Compile\Command','','Reg_Sz','"'& @WorkingDir & '\SciTE\ACNWrapper\AcnWrapper.eXe" /In "%1"')
RegWrite('Hkcr\AutoIt3Script\Shell\Edit','','Reg_Sz','&D. 编辑脚本(记事本)')
RegWrite('Hkcr\AutoIt3Script\Shell\Edit\Command','','Reg_Sz',@SystemDir & '\NotePad.eXe "%1"')
RegWrite('Hkcr\AutoIt3Script\Shell\GUICompile','','Reg_Sz','&F. 编译脚本(带选项)')
RegWrite('Hkcr\AutoIt3Script\Shell\GUICompile\Command','','Reg_Sz','"'& @WorkingDir & '\SciTE\ACNWrapper\AcnWrapper_Gui.eXe" /In "%1"')
RegWrite('Hkcr\AutoIt3Script\Shell\Open','','Reg_Sz','&C. 编辑脚本(SciTE)')
RegWrite('Hkcr\AutoIt3Script\Shell\Open\Command','','Reg_Sz','"' & @WorkingDir & '\SciTE\SciTE.eXe" "%1"')
RegWrite('Hkcr\AutoIt3XScript','','Reg_Sz','AutoIt3XScript')
RegWrite('Hkcr\AutoIt3XScript\DefAultIcon','','Reg_Sz',@WorkingDir & '\Aut2Exe\Icons\TLB.ico')
RegWrite('Hkcr\AutoIt3XScript\Shell\Run','','Reg_Sz','&R. 运行脚本')
RegWrite('Hkcu\AutoIt3XScript\Shell\Run\Command','','Reg_Sz','"' & @WorkingDir & '\AutoIt3.eXe" "%1" "%*"')
……
[ 本帖最后由 ahkang 于 2009-3-4 20:19 编辑 ] |