DarkBoost Posted April 27, 2012 Posted April 27, 2012 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
Moderators JLogan3o13 Posted April 27, 2012 Moderators Posted April 27, 2012 (edited) Hi, DarkBoost. Try ShellExecute rather than run: ShellExecute("Regedit.exe", "/s C:File.reg", "", "", @SW_HIDE) Edit: spelling Edited April 27, 2012 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!
ZacUSNYR Posted April 27, 2012 Posted April 27, 2012 Perhaps look at the native RegWrite function instead of using a .reg file?
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 (edited) 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 Edited April 27, 2012 by DarkBoost
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 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
armoros Posted April 27, 2012 Posted April 27, 2012 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]
armoros Posted April 27, 2012 Posted April 27, 2012 Take a look here if it helps... [font="verdana, geneva, sans-serif"] [/font]
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 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.
armoros Posted April 27, 2012 Posted April 27, 2012 Sorry man...Take a look if it helps.. [font="verdana, geneva, sans-serif"] [/font]
Moderators JLogan3o13 Posted April 27, 2012 Moderators Posted April 27, 2012 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!
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 just so you know => run("regedit c:file.reg") <= this works it is only when adding the " /s " to make it silent which causes it to fail.
ZacUSNYR Posted April 27, 2012 Posted April 27, 2012 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)
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 (edited) JLogan3o13 - there are no errors when i try your suggestion, the script runs and i check the registry and no keys are there. Edited April 27, 2012 by DarkBoost
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 (edited) here is a visual of what is happening... /S = nothing happens Edited April 27, 2012 by DarkBoost
ZacUSNYR Posted April 27, 2012 Posted April 27, 2012 Also @HomeDrive is not always the Windows C drive. Home Folder redirection happens on Domains.
ZacUSNYR Posted April 27, 2012 Posted April 27, 2012 here is a visual of what is happening... /S = nothing happensI took my example above, exported a key, saved it to c:file.reg and deleted the key. Ran the script. And it showed right up.where is the real path to the file?
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 ZacUSNYR - the screenshot shows the exact path, i have simplified it as much as possible to try and find the cause.
ZacUSNYR Posted April 27, 2012 Posted April 27, 2012 (edited) 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 April 27, 2012 by ZacUSNYR
DarkBoost Posted April 27, 2012 Author Posted April 27, 2012 1:49AM... i am off to bed, will try again tomorrow
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now