Your host:
Stephen Chapman
Stephen Chapman

Parameters in Batch Files

Question: Using XCOPY and the date switch ( /d ); is it possible to have the batch file prompt the user for the date to be used? If so, how would this be written.
anonymous

Answer: I don't think you can actually prompt for the date but you can set up the batch file to accept the date as a parameter like this:


if x%1x == xx goto error
xcopy /d:%1
goto end
:error
echo You forgot to enter a date
:end

This same technique can be used to process multiple parameters (using %1 - %9) in whatever processing that you require in any batch file.

go to top

Add to del.icio.us

Computers and PC Hardware
Cheap Electricity - Loans - Credit Cards - Loans