1.

Solve : trim the leading string from the parm?

Answer»

Hi all.
I am getting a parameter date value as %1 into the bat file as "-ap02/01/2004 riTBS981 ji7296", but all I need to get is 02/01/2004 value from the 1st parameter. Can somebody help me on this. I really appreciate the reply.

Thanks
Ashsince i had no WAY of knowing where you got the variable from, i created a file called x.txt and put your variable "-ap02/01/2004 riTBS981 ji7296" in it

then i created a batch file called test.bat:
"
FOR /F "tokens=1-10 delims=-p " %%J IN (%1) DO SET MMDD=%%K
SET correctdate=%MMDD%
ECHO %correctdate%
"

now when you run "test.bat x.txt", you should get just the date and not the unwanted JUNK



Discussion

No Comment Found