Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 11-23-2007, 03:30 AM
alexanderd79@googlemail.com
Tablet PC Guest
 
Posts: n/a
Batch file to rename with time and date

Hi

I have a batch file that renames a file and appends the time on the
end of the filename. What I need it to do is append both the time and
date at the same time. My line of code is:

for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename
"filename.xls" "filename"%%d-%%e-%%f.xls

I'm sure i can do this in one line but not sure how to add the %date%
in correctly

Any help appreciated

Thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 11-23-2007, 03:30 AM
Xploder HD Movie Player for PS3. Manage, convert and transfer media files between the PC and PS3.
  #2 (permalink)  
Old 11-23-2007, 05:00 AM
Pegasus \(MVP\)
Tablet PC Guest
 
Posts: n/a
Re: Batch file to rename with time and date


<alexanderd79@googlemail.com> wrote in message
news:ca05d8ad-d2ab-4099-b622-87eb61ac9c49@e23g2000prf.googlegroups.com...
> Hi
>
> I have a batch file that renames a file and appends the time on the
> end of the filename. What I need it to do is append both the time and
> date at the same time. My line of code is:
>
> for /f "tokens=1-5 delims=:" %%d in ("%time%") do rename
> "filename.xls" "filename"%%d-%%e-%%f.xls
>
> I'm sure i can do this in one line but not sure how to add the %date%
> in correctly
>
> Any help appreciated
>
> Thanks


Perhaps something like this:
for /F "tokens=1-8 delims=:/" %%a in ('echo %date% %time%') do echo ren
"file.xls" "%%a-%%b-%%c %%d-%%e file.xls"


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

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 On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch Rename Eric Windows XP 10 10-03-2007 08:30 PM
Windows Date/Time auto setting to wrong date/time Shadofax Windows XP 4 05-08-2007 10:00 PM
dos batch script to make txt file with date in name SANDY Windows XP 1 02-07-2007 01:32 PM
Rename in a batch file simonc Windows XP 4 01-04-2007 06:18 AM
Rename in a batch file simonc Windows XP 0 01-04-2007 06:18 AM


All times are GMT -8. The time now is 04:28 PM.


2003 - 2008 All Rights Reserved. Technology Questions

SEO by vBSEO 3.1.0