TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: OCTAVIO ALVAREZ PIZA
from: JOSE MEJUTO
date: 1997-01-26 20:01:00
subject: Looking for Command Line.

23/01/97 01:01, Charles Godard escrib¡a a Octavio Alvarez Piza:
Hola Octavio!
 OAP>> I am looking for a way to read the ENTIRE command line used to run
 OAP>> the program..
 CG> See if this will work for you.
 CG> PRINT ENVIRON$("CMDLINE")
 This environment variable don't works in most systems. If you are looking 
or
the complete path and filename that executes your program, you must read the 
DOS
internal environment using peek.
~[GETID.BAS]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Print "Complete command Line  :";GetMainId (0);" ";Command$
Print "Full path and file exec:";GetMainId (0)
Print "EXE source path        :";GetMainId (1)
End
function GetMainID ( byval Code as BYTE ) public as STRING
         dim Tmp as INTEGER
         dim Ptr as INTEGER
         dim Buffer as STRING
         reg 1,&h6200
         call interrupt &h21
         def seg=reg(2)
         Tmp=peeki(&h2c)
         def seg=Tmp
         do
           Buffer=right$(Buffer,1)
           Buffer=Buffer+peek$(Ptr,256)
           incr Ptr,256
           Tmp=instr(Buffer,chr$(0,0))
           if Ptr>16*1024 then error 613
         loop until Tmp
         incr Tmp,4
         Buffer=Buffer+peek$(Ptr,256)
         Buffer=mid$(Buffer,Tmp)
         Tmp=instr(Buffer,chr$(0))
         Buffer=mid$(Buffer,1,Tmp-1)
         if Code then
            do until right$(Buffer,1)="\"
               Buffer$=mid$(Buffer$,1,len(Buffer$)-1)
            loop
         end if
         GetMainID=Buffer
end function
~[end]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~
Saludotes,
       ,,,   JOS (2:348/102)
      `0-0'  jmejuto@pobox.com
     /-(_)-\ SysOp de ÄÍEDIÍBBSÍÄ
     http://www.pobox.com/~jmejuto
---
---------------
* Origin: When I Need Data Output Without Speed 3.1 (2:348/102.99)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.