Modify

Opened 3 months ago

Last modified 2 days ago

#3836 assigned Bug

FileExists with trailing quotation mark

Reported by: therks@… Owned by: Jpm
Milestone: Component: AutoIt
Version: 3.3.15.4 Severity: None
Keywords: FileExists Cc:

Description

Mentioned here first:
https://www.autoitscript.com/forum/topic/206186-fileexists-with-trailing-quote/

For some reason FileExists is treating paths that end with a quote mark (or multiple marks) as valid.

; Assuming File.txt exists:
ConsoleWrite(FileExists('File.txt'))   ; Returns 1
ConsoleWrite(FileExists('"File.txt"')) ; Returns 0
ConsoleWrite(FileExists('"File.txt'))  ; Returns 0
ConsoleWrite(FileExists('File.txt"'))  ; Returns 1
ConsoleWrite(FileExists('File.txt""')) ; Returns 1

Attachments (0)

Change History (3)

comment:1 Changed 3 months ago by therks@…

The following functions all behave similarly (ignoring the trailing quotation marks and returning valid results):
FileGetAttrib, FileGetLongName, FileGetShortName, FileGetSize, FileGetTime

FileGetVersion behaves expectedly, returning "0.0.0.0"

ConsoleWrite(FileExists(@AutoItExe & '""""""') & @LF)        ; Returns 1
ConsoleWrite(FileGetLongName(@AutoItExe & '""""""') & @LF)   ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetShortName(@AutoItExe & '""""""') & @LF)  ; Returns C:\Program Files\AutoIt3\Beta\AutoIt3.exe""""""
ConsoleWrite(FileGetAttrib(@AutoItExe & '""""""') & @LF)     ; Returns A
ConsoleWrite(FileGetSize(@AutoItExe & '""""""') & @LF)       ; Returns 946784
ConsoleWrite(FileGetTime(@AutoItExe & '""""""', 0, 1) & @LF) ; Returns 20210611084604

ConsoleWrite(FileGetVersion(@AutoItExe & '""""""') & @LF)    ; Returns 0.0.0.0 (correct!)

comment:2 Changed 2 months ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Fix sent to Jon

comment:3 Changed 2 days ago by anonymous

* ? < > " are wildcards. The results are expected if you consider what " does.

View https://docs.microsoft.com/en-us/archive/blogs/jeremykuhne/wildcards-in-windows

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as assigned The owner will remain Jpm.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.