Solved

Renaming an excel file

Posted on 2013-11-25
2
309 Views
Last Modified: 2013-11-25
I want to rename a file with date and time stamp, however this seems to be the incorrect syntax.  The computer it's running on is Windows 7, 32bit.

ren new.xls newfile_%time:~0,2%%time:~3,2%-%date:~-10,2%%date:~3,2%%date:~-4,4%.xls

Open in new window

0
Comment
Question by:100questions
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
IanTh earned 500 total points
ID: 39675837
0
 
LVL 54

Expert Comment

by:Joe Winograd, EE MVE
ID: 39676087
Keep in mind that the %date% environment variable returns the current date using the Windows setting for Short Date Format. The problem is likely because your year/month/day offsets in the Rename command don't match those in the Short Date Format. You can change the Short Date Format via:

Control Panel
Region and Language
Formats

Select whatever format you want and then change the Rename command accordingly. For example, if you select yyyy-MM-dd, then here's the command for appending mmddyyyy:

ren new.xls newfile_%time:~0,2%%time:~3,2%-%date:~5,2%%date:~8,2%%date:~0,4%.xls

Of course, put in hyphens or underscores wherever else you want them. Regards, Joe
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
This article summaries thoughts and ideas from two years of sustained use. It provides good reasoning to make the jump to Windows 10.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question