! GetFullPathNameA lib "kernel32.dll"
! GetCommandLineA  lib "kernel32.dll" () as char*
sys fp,pt
int a,i,er
char path[256]
pt=strptr path
er=GetFullPathNameA "gxo2.exe",255,pt,@fp
print er "  " left path,fp-pt
'33 34 not found
'44 ok

string s=GetCommandLineA

if asc(s)=34
  a=instr 2,s,chr(34)
  s=mid(s,2,a-2)
else
  a=instr 2,s,chr(32)
  s=mid(s,2,a-2)
end if

'trim off command filename

int i=len s
int a=0
do
  if i<1 then exit do
  a=asc s,i
  if a=47 or a=92 
    exit do
  end if
  i--
end do
s=left s,i
print s
