PC Review Forums Newsgroups Windows 2000 Microsoft Windows 2000 Developer Creating a folder for today's Date

Reply

Creating a folder for today's Date

 
Thread Tools Rate Thread
Old 14-07-2003, 06:42 PM   #1
Micheal
Guest
 
Posts: n/a
Default Creating a folder for today's Date


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
Old 21-07-2003, 08:32 AM   #2
Oren Nizri
Guest
 
Posts: n/a
Default Creating a folder for today's Date


>-----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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off