Run not running file with number when .exe is available

Report problems with documented functionality
TXShooter
Posts: 115
Joined: 13 Dec 2017, 09:27

Run not running file with number when .exe is available

26 Aug 2018, 09:46

I'm not entirely sure this is a bug, or perhaps by design (which currently doens't make sense to me)...


When I Run an .ahk file that has a number in it (version number, for example), AHK will not run that file if an .EXE file without the number exists in the same directory.

For example, this will run so long as it's the only file with the same name up to the number 3.

Code: Select all

Param1 := 100
Param2 := "My Param2"
Param3 := "My Param3"
Filename = C:\AHK Files\My AHK File 3.0.ahk "{}" "{}" "{}"
Run % Format(Filename, Param1, Param2, Param3)
However, Filename will not run if there exists the file "C:\AHK Files\My AHK File.exe" in the same directory as the AHK versioned file.

Is this by design?
User avatar
jeeswg
Posts: 5286
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Run not running file with number when .exe is available

26 Aug 2018, 10:29

- Try this:

Code: Select all

Param1 := 100
Param2 := "My Param2"
Param3 := "My Param3"
Target = "C:\AHK Files\My AHK File 3.0.ahk" "{}" "{}" "{}"
Run % Format(Target, Param1, Param2, Param3)
- If you don't put the path in quotes, Explorer has to interpret the command-line string that you passed it, to work out what file to execute.
- It sees 'C:\AHK Files\My AHK File' and one of the possible interpretations that it checks is 'C:\AHK Files\My AHK File.exe', if such an exe exists, it is launched. Using quotes for the script path avoids this.
TXShooter
Posts: 115
Joined: 13 Dec 2017, 09:27

Re: Run not running file with number when .exe is available

26 Aug 2018, 11:49

That does explain it. Thank you.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 8 guests