Solved

Renaming an excel file

Posted on 2013-11-25
2
306 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 53

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

By default the complete memory dump option is disabled in windows . If we want to enable the complete memory dump for a diagnostic purpose, we have a solution for it. here we are using the registry method to enable this.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

856 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