PC Review


Reply
Thread Tools Rate Thread

Creating a folder for today's Date

 
 
Micheal
Guest
Posts: n/a
 
      14th Jul 2003
I am trying to create a folder for today's date in a
batch file. I am using the command md "%date%". in the
command window it display the flowing, E:\System
State>md "Mon 07/14/2003". However when you view the
folder the folders name is Mon 07. I know this is
because you can not use / in folder names. Is there a
way I can get the the the date to generate with dashes
instead of /? ie. Mon 07-14-2003

Thanks

Micheal
 
Reply With Quote
 
 
 
 
Oren Nizri
Guest
Posts: n/a
 
      21st Jul 2003

>-----Original Message-----
>I am trying to create a folder for today's date in a
>batch file. I am using the command md "%date%". in the
>command window it display the flowing, E:\System
>State>md "Mon 07/14/2003". However when you view the
>folder the folders name is Mon 07. I know this is
>because you can not use / in folder names. Is there a
>way I can get the the the date to generate with dashes
>instead of /? ie. Mon 07-14-2003
>
>Thanks
>
>Micheal
>.
>


Micheal,

Use this vbscript copy and paste the text to text file
and rename the file to .vbs)

'-------------------------- start ------------------------
Set objFSO = CreateObject("Scripting.FileSystemObject")
dim fold
GetCurrentDate = FormatDateTime(Date, 2)
dim c,d
for x=1 to 10
c=mid(GetCurrentDate ,x,1)
if c="/" then
d=d&"-"
else
d=d&c
end if
next
'msgbox d
Set objFolder = objFSO.CreateFolder("c:\" & d)
'-------------------------- end -------------------------

for more files and folder script you can visit my site
at :

http://scripts.mutsonline.com

Best Regards

Oren Nizri

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
embed today's date dynamically in a folder name? =?Utf-8?B?SnVzdFNvbWVHdXk=?= Windows XP General 2 19th Jul 2007 08:08 PM
how come =date(year(today()),month(today())+6,today()) show 2097? dindigul Microsoft Excel Discussion 4 14th May 2007 09:47 PM
Save spreadsheet into folder based on today's Date? nbaj2k Microsoft Excel Programming 4 7th Aug 2006 02:59 PM
default today's date to field when creating record lauri Microsoft Access Form Coding 2 13th Jul 2004 11:30 PM
Creating a folder for today's Date Micheal Microsoft Windows 2000 CMD Promt 5 21st Jul 2003 04:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:10 PM.