Path: utzoo!attcan!uunet!seismo!dimacs.rutgers.edu!rutgers!apple!olivea!orc!inews!iwarp.intel.com!gargoyle!infopls!awol From: awol@infopls.UUCP (Al Oomens) Newsgroups: comp.lang.pascal Subject: Re: Getting the command line args Message-ID: <9B4Ds4w163w@infopls.UUCP> Date: 9 Nov 90 22:08:07 GMT References: <950041@hpclapd.HP.COM> Organization: INFOPLUS support, Wheeling, IL Lines: 20 defaria@hpclapd.HP.COM (Andy DeFaria) writes: > This is probably obvious to you all but I scanned through the documentation > (pretty quickly) and I didn't come up with anything so I asking: > > How does a running program access the command line arguments? I would like > to do this with Turbo Pascal. There are two TP commands to access the command line: ParamCount, and ParamStr. the first returns the number of parameters on the command line, while the second retrieves the specified parameter. For example: If ParamCount < 1 THEN WriteLn( 'No Parameters on the command line!' ); IF ParamStr( 1 ) = '/v' THEN WriteLn( 'Verify turned on.' ); Also note that ParamStr( 0 ) will return the name of the program executed from the command line.