MSFN Forum: run a .reg file in autoit - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

run a .reg file in autoit Rate Topic: -----

#1 User is offline   ripken204 

  • The Hardware Guy
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 6,311
  • Joined: 23-December 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 29 August 2005 - 02:09 PM

i know how to add reg keys in auto it but what about a .reg file? i exported some things from the registry to a .reg file and it is way too much for me to put it into an autoit file, so i was wondering if there was some way that i could do like Run("reg.reg") but that deosnt work.


#2 User is offline   Mekrel 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 372
  • Joined: 17-November 04

Posted 29 August 2005 - 08:24 PM

Your going to need:

Run("REGEDIT /S Reg.reg")

#3 User is offline   ripken204 

  • The Hardware Guy
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 6,311
  • Joined: 23-December 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 29 August 2005 - 08:54 PM

that simple, thx

#4 User is offline   JohnS 

  • Member
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 14-May 05

Posted 01 September 2005 - 05:46 PM

What if I want to run the .reg file from another path and want to use a directory macro.
For exemple, I want to run reg.reg that is in the system drive, under \install.
What do I put?
Run("REGEDIT /S @homedrive & \install\Reg.reg")
- this does not work
Can someone help this Autoit newbie?
Thanks.

#5 User is offline   ripken204 

  • The Hardware Guy
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 6,311
  • Joined: 23-December 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 01 September 2005 - 06:50 PM

you could try

Run("REGEDIT /S @homedrive & '\install\Reg.reg'")

#6 User is offline   Nologic 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 461
  • Joined: 07-October 03

Posted 01 September 2005 - 07:44 PM

hmm close...more like:

Run("REGEDIT /S " & @homedrive & "\install\Reg.reg")

How ever may need 8.3 file names???

Run("REGEDIT /S " & FileGetShortName ( @homedrive & "\install\Reg.reg" ))

but thats just taking a guess.

#7 User is offline   JohnS 

  • Member
  • PipPip
  • Group: Members
  • Posts: 109
  • Joined: 14-May 05

Posted 02 September 2005 - 07:20 AM

Thank you, you guys are great!

#8 User is offline   blinkdt 

  • Somewhat Knowledgeable
  • PipPipPipPip
  • Group: Members
  • Posts: 582
  • Joined: 30-September 03
  • OS:Vista Ultimate x64
  • Country: Country Flag

Posted 13 November 2005 - 01:34 PM

I second that! This one has bugged me for ages. Special thanks to Nologic for bringin' it home!

#9 User is offline   Nologic 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 461
  • Joined: 07-October 03

Posted 13 November 2005 - 07:54 PM

Your welcome.

Question...was 8.3 file names needed? I never did find out. :)

#10 User is offline   blinkdt 

  • Somewhat Knowledgeable
  • PipPipPipPip
  • Group: Members
  • Posts: 582
  • Joined: 30-September 03
  • OS:Vista Ultimate x64
  • Country: Country Flag

Posted 13 November 2005 - 09:23 PM

Nope, FileGetShortName was not needed. I'm converting many of my scripts based on your find and everything is running smoothly, like so:

Run("REGEDIT /S " & @ScriptDir & "\prefs.reg")

#11 User is offline   MCT 

  • MSFN Junkie
  • PipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 3,288
  • Joined: 19-May 04

Posted 13 November 2005 - 09:41 PM

do u find any (if any) advantages on using autoit vs cmd ?

#12 User is offline   Nologic 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 461
  • Joined: 07-October 03

Posted 13 November 2005 - 10:49 PM

blinkdt -

Thanks for the FYI :)

MCT -

Well you don't get that little flicker from the command window. Hehe one of the few times autoit makes installs just a little cleaner. ;)

Well really MHz added in some code to his CMENU context menu utility that will actually convert most reg files to pure autoit scripts...which then you could convert into exe's so that you have a tad more security hidding important info contained in your reg files.

Really at this point in the game I see no real reason to use cmd files at all and soon there won't be any need for vbs ether.

There is so much more to autoit than silly install scripts like I have displayed in the autoit thread.

Any thing you can currently do in a cmd file you can do in autoit...and autoit is far more flexable.

Go to AutoIts actual forum and see some of the samples they have to show...it'll blow your mind. :)

#13 User is offline   --=ddSHADOW=-- 

  • --=ddSHADOW=--
  • PipPip
  • Group: Members
  • Posts: 209
  • Joined: 08-August 04

Posted 16 November 2005 - 04:17 AM

I just use
Example importing file.reg

#include <Process.au3>
_RunDos("reg import file.reg")


for removing the keys use the long way it works perfect
Example removing autostart of MSN

RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run", "MsnMsgr")

The 1. method for removing .reg contains:
Windows Registry Editor Version 5.00

;Disable MSN
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"MsnMsgr"=-
dosent work durring install of windows


#14 User is offline   m00nw0lf 

  • Group: Members
  • Posts: 3
  • Joined: 14-January 08

Posted 04 May 2011 - 07:08 PM

how would a folder with more then one reg file be applied useing autoit

#15 User is offline   radix 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 715
  • Joined: 08-February 07

Posted 05 May 2011 - 11:20 AM

View Postm00nw0lf, on 04 May 2011 - 07:09 PM, said:

how would a folder with more then one reg file be applied useing autoit

Copy au3 file or compiled in the folder where reg files are located
#Include <File.au3>
#Include <Array.au3>

$RegList = _FileListToArray(@ScriptDir, "*.reg", 1)
 If IsArray($RegList) Then
	For $i = 1 to $RegList[0]
		RunWait('regedit.exe' & ' /s' & ' "' & $RegList[$i] & '"')
	Next
EndIf


#16 User is offline   geosoft 

  • Group: Members
  • Posts: 9
  • Joined: 21-February 10
  • OS:none specified
  • Country: Country Flag

Posted 12 May 2011 - 10:14 AM

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")


#17 User is offline   radix 

  • Friend of MSFN
  • PipPipPipPipPip
  • Group: Members
  • Posts: 715
  • Joined: 08-February 07

Posted 14 May 2011 - 03:44 AM

View Postgeosoft, on 12 May 2011 - 10:14 AM, said:

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.

This post has been edited by radix: 14 May 2011 - 03:45 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy