Jump to content

check for File


Recommended Posts

Trying to check for file exists, but for some reason it isn't working and I think it may be something to do with Windows 7 permissions?  Anyone else run into this problem?  I get File does not exist no matter what.

If FileExists ("c:\windows\system32\test.txt") Then
    MsgBox(4096, "Yes", "File does exist")
Else
    MsgBox(4096, "No", "File does not exist")
EndIf

 

Link to comment
Share on other sites

2 hours ago, Tigerweld said:

compiling it as x64 did the trick!  thanks.  Will this script work on a x86 computer?

From the docs:

Running the 32-bit version of AutoIt on a x64 System

For Files, Windows has a special redirection mechanism for some system directories :

Directories 32-bit Value 64-bit Value
@SystemDir @WindowsDir & "\System32" @WindowsDir & "\SYSWOW64"
@ProgramFilesDir {SystemDrive} & "\Program Files (x86)" {SystemDrive} & "\Program Files"

It's possible to access the 64-bit version of those directories by disabling the redirection mechanism.

#include <WinAPIFiles.au3>

_WinAPI_Wow64EnableWow64FsRedirection(True)

Additional information can be found at MSDN.

For registry interaction, use HKCR64 or HKLM64 to bypass the redirection mechanism see Registry Functions documentation.

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

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...