Xichael Posted March 5, 2017 Share Posted March 5, 2017 (edited) The 64 bit version is able to access C:\Windows\System32\tscon.exe just fine, but 32 bit can't find it. #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> Example() Func Example() ; Create a constant variable in Local scope of the filepath that will be read/written to. Local Const $sFilePath = "C:\Windows\System32\tscon.exe" Local $iFileExists = FileExists($sFilePath) ; Display a message of whether the file exists or not. If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists." & @CRLF & "FileExist returned: " & $iFileExists) Else MsgBox($MB_SYSTEMMODAL, "", "The file doesn't exist." & @CRLF & "FileExist returned: " & $iFileExists) EndIf EndFunc ;==>Example Edited March 5, 2017 by Xichael Link to comment Share on other sites More sharing options...
Subz Posted March 5, 2017 Share Posted March 5, 2017 Your deleting C:\Windows\System32\tscon.exe, why? Link to comment Share on other sites More sharing options...
Xichael Posted March 5, 2017 Author Share Posted March 5, 2017 (edited) No. That's just the example taken from: https://www.autoitscript.com/autoit3/docs/functions/FileExists.htm I'm actually trying to launch the exe from a script using: ShellExecute('tscon', '1 /dest:console', '', 'runas') After hours of trying and failing to get it working, I finally found this issue. Now that I know, I'll just make sure to run x64, but thought I should bring this to people's attention. It's a weird one. Edited March 5, 2017 by Xichael Link to comment Share on other sites More sharing options...
Subz Posted March 5, 2017 Share Posted March 5, 2017 You might want edit your first post and delete the FIleDelete function in case someone inadvertently runs it. For getting this to work you can use FileSystem Redirection for example: _WinAPI_Wow64EnableWow64FsRedirection(True) ShellExecute(@WindowsDir & '\System32\tscon.exe', '1 /dest:console', '', 'runas') _WinAPI_Wow64EnableWow64FsRedirection(False) Link to comment Share on other sites More sharing options...
Xichael Posted March 5, 2017 Author Share Posted March 5, 2017 (edited) Sorry, I removed that line. Guess it served a purpose in the original example script. Good to know about that WoW64 redirection stuff. Pretty esoteric stuff. Thanks! Edited March 5, 2017 by Xichael 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