Solved

Renaming an excel file

Posted on 2013-11-25
2
299 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
2 Comments
 
LVL 30

Accepted Solution

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

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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

762 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now