need to rename a folder in the current date u

January 30, 2011 at 22:43:04
Specs: Windows 2003 server
Hi

I am having an folder called "test" in one of my location. I need to replace the folder this way"test.mm/dd/yyyy. Please help me out. I need a bat file to run this every week.

Regards,
Guna


See More: need to rename a folder in the current date u

Report •

#1
January 31, 2011 at 07:35:58
you can not use "/"s in file or folder names. You have to use "-". As far as scripts you need to use parsing to get the date...

@echo off

Set Day=%Date:~-7,2%
Set Month=%Date:~-10,2%
Set Year=%Date:~-4,4%
Set TodayDate=%Year%-%Day%-%Month%

Set Hour=%Time:~-11,2%
Call :TrimHour %Hour%
Set Minute=%Time:~-8,2%
Set Second=%Time:~-5,2%
Set TodayTime=%Hour%-%Minute%-%Second%

Ren c:\test c:\test%TodayDate%


Report •

#2
January 31, 2011 at 21:35:23
Hi Ace,

Following error occurs

The system cannot find the batch label specified - TrimHour
The syntax of the command is incorrect.

Please help me out,.


Report •

#3
February 1, 2011 at 08:15:01
@echo off

Set Day=%Date:~-7,2%
Set Month=%Date:~-10,2%
Set Year=%Date:~-4,4%
Set TodayDate=%Year%-%Day%-%Month%

Ren c:\test c:\test%TodayDate%

oops for got to remove the time stuff.


Report •
Related Solutions


Ask Question