C:\sys\AutoHotkey\SheBang\SheBang.exe %1
"C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" /n "%1"
%SystemRoot%\system32\NOTEPAD.EXE %1
I cannot do a call to FileExist() on such kind of strings.
So, I've dev this function but it's not perfect and can probably be replaced by a more efficient one.
Code: Select all
get_RawPath( CmdPath ){
if RegExMatch( CmdPath, "%([^%]+)%", o_Match ) {
valueEnv := EnvGet(o_Match.Value(1))
if valueEnv
CmdPath := StrReplace( CmdPath, "%" o_Match.Value(1) "%" , valueEnv,,, Limit:=1 )
}
arr := StrSplit( CmdPath, ['%','/'] )
if arr.Length > 0
return Trim( StrReplace( arr[1], '`"' ) )
else
return Trim( StrReplace( CmdPath, '`"' ) )
}
f := get_RawPath( '"C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE" /n "%1"' )
MsgBox f "`n" (FileExist( f )?"Exists":"Doesn't exists")
; C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE
; Exists
Does someone know another way to do that ?
I guess there's probably a WinAPI function to do it.