Advertisement

06.27.2008 at 01:01AM PDT, ID: 23520844
[x]
Attachment Details

Date Validation in DOS passed in as command line arguement

Asked by mistermuv in MS DOS, Windows Batch Scripting

Hi Experts

When I type echo %date% in DOS I get "26/06/2008" (WinXP SP2)
I would like a batch file that will accept and validate an arguement in the "yyyymmdd" format
I am looking to call the batch file passing in command line arguements like such:
batchFile 20080627

I know in the batch file I can pick up the arguement as %1 but I don't know how to validate said arguement as an accepted format and a valid date and that the an arguement has indeed being passed in to the batch in the first place.

In the batch file itself the program will call a couple of java programs that also accept command line arguements too.  For example
javaProgram fileName_20080625.csv
javaProgram fileName_20080626.csv
javaProgram fileName_20080627.csv

So I can change this to something like:
javaProgram fileName_%1.csv

How can I best do this?
Thankyou in advance.Start Free Trial
[+][-]06.27.2008 at 02:54AM PDT, ID: 21882090

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 03:32AM PDT, ID: 21882240

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 07:16AM PDT, ID: 21883982

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 07:31AM PDT, ID: 21884167

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS DOS, Windows Batch Scripting
Sign Up Now!
Solution Provided By: farhankazi
Participating Experts: 2
Solution Grade: A
 
 
[+][-]06.27.2008 at 07:36AM PDT, ID: 21884215

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.27.2008 at 07:47AM PDT, ID: 21884333

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628