Extraction of ExePath from the commandline:
'include $/inc/minwin.inc
! GetCommandline "GetCommandLineA" lib "kernel32.dll"
function GetExePath() as string
================================
char* s=getCommandline
byte *b=strptr s
sys bb=@b,bs=@b,mm=0,ms=0
do
select case b
case 0 : exit do
case 32 : if mm=0 : exit do ' space (no quote at start)
case 34 : if mm : exit do ' " double quote
mm=@b
bs=@b+1
case 47 : ms=@b ' / fwd slash
case 92 : ms=@b ' \ back slash
end select
@b++
end do
if ms then return mid s,bs-bb+1,ms-bs+1 'includes end slash
end function
print GetExePath