Missed input parameter to be echoed / prompted

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
swapan
Posts: 1
Joined: 24 Apr 2012 03:47

Missed input parameter to be echoed / prompted

#1 Post by swapan » 24 Apr 2012 03:57

We have a batch script which takes user input parameters(5 parameters). If by mistake we forget to provide any particular parameter, we want that particular parameter to be echoed out / prompted in dos prompt.

jeb
Expert
Posts: 1062
Joined: 30 Aug 2007 08:05
Location: Germany, Bochum

Re: Missed input parameter to be echoed / prompted

#2 Post by jeb » 24 Apr 2012 04:41

If you missed a parameter, what do you expect to get if you will echo it out?
I suppose you get nothing for an empty parameter.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Missed input parameter to be echoed / prompted

#3 Post by Squashman » 24 Apr 2012 05:47

Might help if you actually posted the code you are using. Then someone could give you some ideas on adjusting your code.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Missed input parameter to be echoed / prompted

#4 Post by foxidrive » 24 Apr 2012 11:10

Or use this:

Code: Select all

@echo off
if "%~5"=="" (
echo Try again with the right number of parameters, you numbskull!
pause
goto :EOF
)
echo rest of batch file goes here.

Post Reply