| 1. |
Solve : Validation yyyymmdd.txt? |
|
Answer» Hi all, Hey there Hi thanks for your reply, but I've tested it out and it doesn't seem to validate the date properly. Is there any way of doing the validation in the MS-DOS batch program itself?? Yes heres the code: Code: [Select]@echo off :enterdate cls echo Enter date to check(YYYYMMDD format) set /p datein=? set yearin=%datein:~4% set monthin=%datein:~4,2% set dayin=%datein:~6,2% set curdate=%DATE:~4,10% set fulldatein=%yearin%/%monthin%/%dayin% if %fulldatein% EQU %curdate% ( echo Valid date..Begin search pause goto Search ) else ( echo Invalid date, please re-enter date pause goto enterdate ) :Search You can add your file search code after the Search label Hi there Thanks for your post. I have tried your program.. and tried to enter a date like this:20091126 for today but it doesn't seem to work?? What is a valid date for this?when you say it doesn't validate properly, what is the error? show what you have done. Don't just say it doesn't work!!!! You can't really validate a date like that in batch. You have to take care certain things like whether there is a february 29 or not etc... USING vbscript's date check is the simplest way to go. |
|