Jump to content

Recommended Posts

Posted (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 by Xichael
Posted (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 by Xichael
Posted

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)

 

Posted (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 by Xichael

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
  • Recently Browsing   0 members

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