Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DOS Batch parameter

Status
Not open for further replies.

bxgirl

Programmer
Nov 21, 2005
75
US
I need to create a batch file that accepts user input (asking for a filename)

Or can you direct me to some primers on dos batch files.

Thanks.
 
Well basically paramters can be accessed via the %1-N variables so for example:

Code:
@ECHO OFF
echo %1

this Prints to the screen the first paramter that the bat file receives. if you were to call it like:

C:\> mybatfile someparameter
it would print out
[green]someparamter[/green]

If you need to pass on more paramters, the subsequen parameters can be found in the consecutive variables.

Code:
...
echo The parameters passed were: %1 , %2 and %3
...

if you were to call it like:

C:\> mybatfile param1 param2 param3
it would print out:
The parameters passed were:[green]param1[green], [green]param2[/green] and [green]param3[/green].

For a more in-depth look check this URL:



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top