Automated rename not working

I have an old server that has had a backup hardware failure. The server is going to be replaced. Instead of getting a new tape drive and tapes, portable hard drives were purchased to use for backing up. The server has USB 1 on it and the backups were terribly slow. I connected the drive to a workstation and this improved the speed but not enough. I am sending the backup to a workstation and I have a backup routine to move the files from the workstation to the portable hard drive. All of this works fine but I am trying to rename the backup folder to a name with the date and time using a batch file to accomplish all of this. The only snag in this is the rename. I tested the batch file in my office and it works fine but at my customers I get a syntax error. This is the command:

ren e:\Backup-to-disk %date:~-10,2%"-"%date:~-7,2%"-"%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%

What is going wrong?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MASEE Solution Guide - Technical Dept HeadCommented:
first you try to get the date format by running "echo %date%"
then change accordingly.

If you dont know please let me know the result you get when running "echo %date%" and let me know what is the name format you required
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Depending on the date format used in Windows, the result should be
but everything should be in one pair of double quotes or none.
ren e:\Backup-to-disk %date:~-10,2%-%date:~-7,2%-%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%

Open in new window

However, I cannot see why you should get a syntax error.
jbcbussoftAuthor Commented:
MAS, I will have access to the computer after 4:30 CDT. I will report the results then.

Olemo, "However, I cannot see why you should get a syntax error." Agreed! I tried this on my pc first with no problems. I wanted some fresh eyes on this since I was seeing no problem.
Become a Microsoft Certified Solutions Expert

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

jbcbussoftAuthor Commented:
I have removed the time portion of the string and I no longer am getting an error. Since I don't need the time I have removed this from the string thus resolving the problem.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jbcbussoftAuthor Commented:
That isn't what I did. I split the points 3 ways even though I solved my own problem.
jbcbussoftAuthor Commented:
Thanks for the input!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows OS

From novice to tech pro — start learning today.