Jump to content

regedit /s works in .BAT but not in AutoIT?


Recommended Posts

Batch File = REGEDIT /S C:\FILE.REG <= this works

AUTOIT = Run("REGEDIT /S C:\FILE.REG") <= this fails

I have tried a variety of ways of writing this and even tried adding #RequireAdmin which all fail and leads me to think its a windows permission?

I am using Windows 7 Enterprise (64bit) with SP1 installed and using a full Administrator account.

I am also using AutoIT 3.3.8.1 with the SciTE 2.28

Any suggestions would be greatly appreciated ;)

Link to comment
Share on other sites

  • Moderators

Hi, DarkBoost. Try ShellExecute rather than run:

ShellExecute("Regedit.exe", "/s C:File.reg", "", "", @SW_HIDE)

Edit: spelling

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

if need be i will just execute the line from a batch file called from AutoIT which does work... it is just a shame that AutoIT can not do this!?

I disabled my AVG Anti-Virus thinking if may have been due to this but same result. has stumped me, normally this works a treat ;)

Link to comment
Share on other sites

Run("REGEDIT /S Reg.reg")

Run("REGEDIT /S " & @homedrive & "installReg.reg")

or

How ever may need 8.3 file names?

Run("REGEDIT /S " & FileGetShortName ( @homedrive & "installReg.reg" ))

or

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

or

#Include <File.au3>

#Include <Array.au3>

$sPath = "c:somepathcontainingregfiles"

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

[font="verdana, geneva, sans-serif"] [/font]

Link to comment
Share on other sites

tried:

run("regedit /s " & @HomeDrive & "file.reg") <= failed

run("regedit /s " & FileGetShortName(@HomeDrive & "file.reg")) <= failed

I do not think the issue is how its being written but more between AutoIT and Windows which is why I think it may be due to permissions or something?

I checked Group Policy and there is full access to the registry and like I mentioned I am using a full administrator account to login to windows.

Link to comment
Share on other sites

  • Moderators

DarkBoost, are you receiving an error when running it as ShellExecute? I run that command often for this process, and have not had it fail before unless I don't have permissions on the box.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

JLogan3o13 - thanks for replying, I have already tested this layout and it is the same result.

ZacUSNYR - a good suggestion however I have almost 600 lines of code to add to the registry, something I really prefer to keep in the .REG file

Makes sense.

What about just running it through the comspec?

$sRegFile = "C:file.reg"
Run(@ComSpec & ' /c "' & @WindowsDir & 'regedit.exe" /S ' & $sRegFile)
Link to comment
Share on other sites

What you're doing does work though. I run it, get the CMD window and my reg key shows up.

If you run /c instead of /k the cmd window will close. You won't see the cmd entered in the window if that's what you're expecting?

Edited by ZacUSNYR
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
 Share

  • Recently Browsing   0 members

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