This may have been reported previously, but some files that manifestly exist (for example C:\pagefile.sys and C:\swapfile.sys) are not detected as existing by FileExist() (which returns an empty string) or even by the old IfExist command, yet are fully recognized by Attrib.exe (which correctly displays their attributes) or by CMD's "If Exist ..." syntax.
Is there a workaround within AutoHotkey (i.e. not involving an external program)? [planning to look into possibly using WMI, but I thought I'd ask as well -- also wondering whether AHK v2 has better luck detecting such files].
Thanks.
JB
FileExist() "blind spots" Topic is solved
Re: FileExist() "blind spots" Topic is solved
Code: Select all
#Requires AutoHotkey v1.1.33
Loop Files, C:\swapfile.sys
found := True
If found
MsgBox 64, Status, Found it!
Else MsgBox 48, Status, Nope!
Re: FileExist() "blind spots"
Excellent, Mikey! That'll work very nicely.
I'd considered that but using the parent folder with a wildcard (like Loop, Files, C:\* in this case) but that seemed highly inefficient to check for a single file's existence-- totally forgot that a single file can be specified (event though I frequently use that method to convert relative filespecs to fully qualified via A_LoopFileLongPath).
Thanks again.
I'd considered that but using the parent folder with a wildcard (like Loop, Files, C:\* in this case) but that seemed highly inefficient to check for a single file's existence-- totally forgot that a single file can be specified (event though I frequently use that method to convert relative filespecs to fully qualified via A_LoopFileLongPath).
Thanks again.