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.

Date Parsing using cmd line scripting code FOR

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gordon Chiu - 19 May 2004 17:46 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 the parsing  date, I got only the day and the year; th 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
Jon Skeet [C# MVP] - 19 May 2004 18:14 GMT
> Hi,
>
[quoted text clipped - 15 lines]
> 05192004 without the Wed so that I can use %Date% as my filename.
> Please help. Thanks in advance.

I'd ask in one of the scripting groups if I were you - I don't think
it's on-topic in this group.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Gordon Chiu - 19 May 2004 19:51 GMT
Hi Jon

I have tried to post it to the scripting group, but, it keeps showing up at the English Group.  How can I do it?  Please advise.  Thank

-Gordo
   
    ----- Jon Skeet [C# MVP] wrote: ----
   
    Gordon Chiu <anonymous@discussions.microsoft.com> wrote
    > Hi
    >> I would like to copy and rename a file with the system date (Windo
    > 2000 Professional OS) as the filename by using the FOR scripting cod
    > 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 the parsing date, I got only the da
    > and the year; th month is missing. If I change the tokens=1-4, then
    > got the "Wed 05192004" with "Wed" in front of it. How can I get onl
    > 05192004 without the Wed so that I can use %Date% as my filename
    > Please help. Thanks in advance
   
    I'd ask in one of the scripting groups if I were you - I don't think
    it's on-topic in this group
   
    --
    Jon Skeet - <skeet@pobox.com
    http://www.pobox.com/~skee
    If replying to the group, please do not mail me to
Jon Skeet [C# MVP] - 19 May 2004 21:59 GMT
> I have tried to post it to the scripting group, but, it keeps showing
> up at the English Group. How can I do it? Please advise. Thanks

I'm not sure what you mean by "the English Group" but I would suggest
using an NNTP newsreader instead of the web access - point your
newsreader (eg Outlook Express) at news.microsoft.com and you should be
able to easily post to the appropriate group that way.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


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.