1.

Solve : arguments in ms dos?

Answer»

how do i write a batch file that takes in one argument and print it out ?

do I use the set command
example

@echo off
set myname=bob
echo hello my NAME =%myname%
echo how do you do

ALSO what is the PATH variable USED for

cheers
new to ms-dos
ramones :-?



A batch file that takes in one argument as a parameter?

Try this:
Code: [Select]@echo off
echo hello my name = %1
echo how do you do
If you name the file mybatch.bat then run it LIKE:
mybatch BobIn a batch file %1 is the first parameter, %2 is the second parameter, etc. If you PASS a name with a space like:
Bob Smith
Then %1 would be Bob and %2 would be Smith



Discussion

No Comment Found