Scripting: Date parsing using FOR /f

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I would like to copy and rename a file with the system date (Window 2000 Professional OS) as the filename by using the FOR scripting code in a batch file

Here is my code

copy E:\tv63_share\loncprod.prn E:\tv63_share\????????2.pr
for /f "tokens=2-4 delims=/" %%a in ('DATE /T') do set Date=%%a%%b%%
E
cd tv63_shar
ren loncprod2.prn %Date

However, the FOR code used in parsing date, I got only the day and the year; the month is missing. If I change the tokens=1-4, then I got the "Wed 05192004" with "Wed" in front of it. How can I get only 05192004 without the "Wed" so that I can use %Date% as my filename. Please help. Thanks in advance

-Gordon Chiu
 
=?Utf-8?B?R29yZG9uIENoaXU=?= said:
I would like to copy and rename a file with the system date (Window 2000
Professional OS) as the filename by using the FOR scripting code in a
batch file.

Here is my codes

copy E:\tv63_share\loncprod.prn E:\tv63_share\????????2.prn
for /f "tokens=2-4 delims=/" %%a in ('DATE /T') do set Date=%%a%%b%%c
E:
cd tv63_share
ren loncprod2.prn %Date%

How does this relate to the .NET framework? Is this Batch.NET?


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
 
Hi Chad

It has nothing to do with .Net, I tried to post it to the scripting group. But, it keeps showing up here. Excuse me for stepping into wrong territory

-Gordo

----- Chad Z. Hower aka Kudzu wrote: ----

=?Utf-8?B?R29yZG9uIENoaXU=?= said:
I would like to copy and rename a file with the system date (Window 200
Professional OS) as the filename by using the FOR scripting code in
batch file.
for /f "tokens=2-4 delims=/" %%a in ('DATE /T') do set Date=%%a%%b%%
E
cd tv63_shar
ren loncprod2.prn %Date

How does this relate to the .NET framework? Is this Batch.NET


-
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu
"Programming is an art form that fights back

Develop ASP.NET applications easier and in less time
http://www.atozed.com/IntraWeb
 
Back
Top