Creating file extension associations

assoc .ahk=ahkfile
ftype ahkfile=C:\path\to\program.exe "%1"
Variable Value
%0, %1 file being launched
%* all arguments
%2, %3 the first arg (%2), the second arg (%3), etc.
%~<n> the remaining arguments, starting with the nth arg (2 ≤ n ≤ 9)

reference