After some tinkering, I was able to get this to run, but I would like to understand why the file path requires quotation marks, but the path to the AHK exe (which is also a variable) does not?
Edit -
Answer (thanks @andymbody for the link):
In most cases, quote marks only have the effect of toggling the interpretation of spaces.
Code: Select all
;===================================
;SETUP
;===================================
#SingleInstance Force
;-----------------------------------
;PATHS
;-----------------------------------
AHKRootPath := "D:\AutoHotkey\"
AHKPathv1 := "D:\AutoHotkey\AutoHotkeyU64.exe"
AHKPathv2 := "D:\AutoHotkey\v2\AutoHotkey64.exe"
V1TestPath := "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V1.ahk"
V2TestPath := "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V2.ahk"
;===================================
;===================================
;CODE
;===================================
;-----------------------------------
;PART ONE - Version 1
;-----------------------------------
;#Requires AutoHotkey v1.1.33+
;-----------------------------------
;V1 run - full paths (works)
;run, "D:\AutoHotkey\AutoHotkeyU64.exe" "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V1.ahk"
;run, "D:\AutoHotkey\v2\AutoHotkey64.exe" "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V2.ahk"
;-----------------------------------
;V1 run - semi variable (works)
;-----------------------------------
;run, %AHKRootPath%\AutoHotkeyU64.exe "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V1.ahk"
;run, %AHKPathv1% "D:\AutoHotkey\Compiler\!TESTING\!V2\Test V1.ahk"
;-----------------------------------
;V1 run - full variables (works)
;-----------------------------------
;run, %AHKPathv1% "%V1TestPath%"
;run, %AHKPathv2% "%V2TestPath%"
;-----------------------------------
;-----------------------------------
;PART TWO - Version 2
;-----------------------------------
#Requires Autohotkey v2.0+
Run(AHKPathv1 " `"" V1TestPath "`"")
Run(AHKPathv2 " `"" V2TestPath "`"")