Emiel Wieldraaijer Posted March 14, 2010 Share Posted March 14, 2010 (edited) Hi, I'm not sure if this is a Windows limitation or a Bug in AutoIt. If you run the following code on Windows 7 X64 you will get the message that rstrui.exe not exists in Windows\System32 but it exists if you execute rstrui from Windows start menu - run command it will run system restore. If you use the AutoIt Run command or shellexecute it does not If FileExists (@WindowsDir & "\system32\regsvr32.exe") Then Msgbox (64, "Regsvr32", "Exists") RunWait (@WindowsDir & "\system32\regsvr32.exe") Else Msgbox (16, "Regsvr32", "Not exists") EndIf If FileExists (@WindowsDir & "\system32\rstrui.exe") Then Msgbox (64, "Rstrui.exe", "Exists") RunWait (@WindowsDir & "\system32\rstrui.exe") Else Msgbox (16, "Rstrui.exe", "Not exists") EndIf ; The following line will do nothing RunWait(@WindowsDir & "\system32\rstrui.exe") ; The following line will give you an error saying the file does not exist ShellExecuteWait(@WindowsDir & "\system32\rstrui.exe") Edited March 14, 2010 by Emiel Wieldraaijer Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
Developers Jos Posted March 14, 2010 Developers Share Posted March 14, 2010 Add this line at the top of the script and try again: #RequireAdmin Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 14, 2010 Author Share Posted March 14, 2010 @Jos Sorry forgot to mention it .. Even with #requireadmin it will not work... (another bug #requireadmin does not work when script isn't compiled. Already reported in the bugtracker) AutoIt version 3.3.6.0 (X86 version) Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
Developers Jos Posted March 14, 2010 Developers Share Posted March 14, 2010 (edited) Not sure if a X64 utility can be properly shelled from a X86 cmd environment. When I start CMD from "C:\Windows\SysWOW64" and then go to "C:\Windows\System32" and try to shell rstrui.exe i get: C:\Windows\System32>rstrui.exe 'rstrui.exe' is not recognized as an internal or external command, operable program or batch file. Isn't that really what you are trying to do here? Edited March 14, 2010 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 14, 2010 Author Share Posted March 14, 2010 @Jos I can run rstrui.exe from the command prompt in Windows 7 X64 for c:\windows\system32 i can use the dir command C:\Windows\System32>dir rstrui.exe Het volume in station C heeft geen naam. Het volumenummer is 8090-A9A5 Map van C:\Windows\System32 14-07-2009 02:39 296.960 rstrui.exe 1 bestand(en) 296.960 bytes 0 map(pen) 390.757.281.792 bytes beschikbaar C:\Windows\System32> But AutoIt cannot Windows 7 X64 Ultimate English (Dutch language MUI installed) Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
Developers Jos Posted March 14, 2010 Developers Share Posted March 14, 2010 I understand, but when you are in a X86 environment you will start the X86 cmd.exe and not the x64 version of CMD.exe. Your tests are with the x64 version. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
trancexx Posted March 14, 2010 Share Posted March 14, 2010 You have to be sure what you run. If you run AutoIt x64 you will have this and with x86 that.Likely there are no bugs, only misunderstandings.Is this working?#AutoIt3Wrapper_UseX64=y ShellExecuteWait(@WindowsDir & "\system32\rstrui.exe")Or maybe this?#AutoIt3Wrapper_UseX64=n DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0) ShellExecuteWait(@WindowsDir & "\system32\rstrui.exe")But why @WindowsDir & "\system32..." ? ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Raven1 Posted March 14, 2010 Share Posted March 14, 2010 trancexx is correct. On x64 Vista and Windows 7, file system redirection redirects calls to the system32 folder by 32-bit programs to the syswow64 folder, but there is no 32-bit version of System Restore (rstrui.exe) in the syswow64 folder. You can use the code below to temporarily disable File System Redirection while you make the call. If @OSArch = "X64" Then Local $stOldVal = DllStructCreate("dword") DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "ptr", DllStructGetPtr($stOldVal)) ShellExecute (@WindowsDir & "\System32\rstrui.exe") DllCall("kernel32.dll", "int", "Wow64RevertWow64FsRedirection", "ptr", DllStructGetPtr($stOldVal)) Else ShellExecute (@WindowsDir & "\System32\rstrui.exe") EndIf Synapsee 1 Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 14, 2010 Author Share Posted March 14, 2010 @Jos Thanks.. (ik had het beter in het nederlands kunnen uitleggen/i should have explained the problem in dutch) @Trancexx DllCall("kernel32.dll", "boolean", "Wow64EnableWow64FsRedirection", "boolean", 0) Does the trick @SystemDir did retrieve c:\windows\SysWOW64 and not c:\windows\system32 rstrui.exe only exists in c:\windows\system32 Thanks Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
dani Posted March 14, 2010 Share Posted March 14, 2010 What's with all the Dutch people and AutoIt Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted March 15, 2010 Author Share Posted March 15, 2010 @Raven1 Thanks @Dani, I really don't know .. maybe because it's free ... we dutch like free .. but we don't like spam.. and it's free Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
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