Jump to content

run a .reg file in autoit


Recommended Posts

Instead of moving the script or the reg files around to get everything in @ScriptDir

You are better of to use FileChangDir()

#Include <File.au3> 
#Include <Array.au3>
$sPath = "c:\somepath\containing\regfiles"
FileChangeDir($sPath)
$RegList = _FileListToArray($sPath, "*.reg", 1)
If IsArray($RegList) Then
For $i = 1 to $RegList[0]
RunWait('regedit.exe' & ' /s' & ' "' & $RegList[$i] & '"')
Next
EndIf

Also I can't remember if it's okay to put the "/s" switch after the file name or not (for RegEdit) but if it is then instead of RunWait() use ShellExecuteWait()

ShellExecuteWait($RegList[$i], "/s")

Link to comment
Share on other sites


Instead of moving the script or the reg files around to get everything in @ScriptDir

You are better of to use FileChangDir()

#Include <File.au3> 
#Include <Array.au3>
$sPath = "c:\somepath\containing\regfiles"
FileChangeDir($sPath)
$RegList = _FileListToArray($sPath, "*.reg", 1)
If IsArray($RegList) Then
For $i = 1 to $RegList[0]
RunWait('regedit.exe' & ' /s' & ' "' & $RegList[$i] & '"')
Next
EndIf

Also I can't remember if it's okay to put the "/s" switch after the file name or not (for RegEdit) but if it is then instead of RunWait() use ShellExecuteWait()

ShellExecuteWait($RegList[$i], "/s")

I've thought about using the script during windows installation (in this case another instance will run the compiled file and it's easy to copy and run from the reg files folder).

Regarding the switch: it's tested and working.

Edited by radix
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...