The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: vasant on November 23, 2005, 01:56:33 PM

Title: Help me please :How to Load text argument from command line to program.
Post by: vasant on November 23, 2005, 01:56:33 PM
Like:
a\> Progarm Text


When run Program

: Text


a\> Program Get_txt
: Get_txt


How to Coding?
Thank you.
Title: Re: Help me please :How to Load text argument from command line to program.
Post by: Gustav on November 23, 2005, 02:22:11 PM

first show us that you have done some efforts on your own, please!

Title: Re: Help me please :How to Load text argument from command line to program.
Post by: vasant on November 23, 2005, 09:03:58 PM
I want to  create program reproduce Dos 's attrib File .
Like:
A\> attrib +r -r Filename 

But I don' t know Code for get Argument (+r -r Filename)  from commandline.
If no Argument is

A\> attrib

I want is Standardcoding for get Argument to Program.

Like:
Standrad Code for exit to Dos is
mov ah,4ch
int 21h
Title: Re: Help me please :How to Load text argument from command line to program.
Post by: MichaelW on November 24, 2005, 01:05:19 AM
There is no dedicated DOS service for reading command line arguments. Getting the entire command line is easy. If you are duplicating ATTRIB the most difficult part will probably be extracting and recognizing the individual arguments.

ATTRIB [+R|-R] [+A|-A] [+S|-S] [+H|-H][[drive:][path]filename] [/S]

Some information on the command line is available here:

http://www.masmforum.com/simple/index.php?topic=3149.msg24137#msg24137

The Microsoft documentation refers to the command line arguments as the "command tail". Here is an example in the form of a MASM data definition:

SampleCommandTail db 7, " /c dir", 0Dh

Some programs may require the leading space. The argument delimiters are normally a space or a tab.

If for some reason you cannot get the PSP address by other means, Interrupt 21h functions 51h and 62h will return the segment address of the PSP for the current program.