Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / May 2004

Tip: Looking for answers? Try searching our database.

Scripting: Date parsing using FOR /f

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gordon Chiu - 19 May 2004 18:06 GMT
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
Chad Z. Hower aka Kudzu - 19 May 2004 19:02 GMT
"=?Utf-8?B?R29yZG9uIENoaXU=?=" <anonymous@discussions.microsoft.com> wrote
in news:C36E54B7-D0CF-47A1-97A4-22C38EE98E00@microsoft.com:
> 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
[quoted text clipped - 7 lines]
>   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/
Gordon Chiu - 19 May 2004 20:01 GMT
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=?=" <anonymous@discussions.microsoft.com> wrot
    in news:C36E54B7-D0CF-47A1-97A4-22C38EE98E00@microsoft.com:
    > 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.
    >> 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
   
    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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.