Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Rename Command stopped working in Batch File

Posted on 2013-01-25
1
Medium Priority
?
555 Views
Last Modified: 2013-01-25
Hello Experts,

I have a batch file that has been working until today.
For some reason these 2 lines of code below are no longer working.

rename SR1171_Sync_Files.txt SR1171_Sync_Files_%date:~4,2%-%date:~7,2%-%date:~10,4%_At_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.txt
rename SR1171_Sync_Files_Log.txt SR1171_Sync_Files_Log_%date:~4,2%-%date:~7,2%-%date:~10,4%_At_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.txt

If I run them from the command line they work just fine.

What could be causing this problem?

Below is the complete batch file, I did remove some of the code that is not related to the issue:

cd C:\Users\pardone\Desktop\SR\Upload Files To SharePoint
setlocal
set MyLogFile=SR1171_Sync_Files.txt

echo %Date% %time%
@echo on
echo ==================================================:  %Date% %time% >> %MyLogFile%

echo Sync_Files Started: %Date% %time% >> %MyLogFile%

rem change the following line as needed to point to source and dest paths and log file name

:: Some code for robocopy Code removed

call :REPORT_ERRORLEVEL

:REPORT_ERRORLEVEL
if errorlevel 16 echo Error Level 16 ***FATAL ERROR*** >> %MyLogFile% & call :END
if errorlevel 15 echo Error Level 15 OKCOPY + FAIL + MISMATCHES + XTRA >> %MyLogFile% & call :END
if errorlevel 14 echo Error Level 14 FAIL + MISMATCHES + XTRA >> %MyLogFile% & call :END
if errorlevel 13 echo Error Level 13 OKCOPY + FAIL + MISMATCHES >> %MyLogFile% & call :END
if errorlevel 12 echo Error Level 12 FAIL + MISMATCHES >> %MyLogFile% & call :END
if errorlevel 11 echo Error Level 11 OKCOPY + FAIL + XTRA >> %MyLogFile% & call :END
if errorlevel 10 echo Error Level 10 FAIL + XTRA >> %MyLogFile% & call :END
if errorlevel 9 echo Error Level 9 OKCOPY + FAIL >> %MyLogFile% & call :END
if errorlevel 8 echo Error Level 8 FAIL >> %MyLogFile% & call :END
if errorlevel 7 echo Error Level 7 OKCOPY + MISMATCHES + XTRA >> %MyLogFile% & call :END
if errorlevel 6 echo Error Level 6 MISMATCHES + XTRA >> %MyLogFile% & call :END
if errorlevel 5 echo Error Level 5 OKCOPY + MISMATCHES >> %MyLogFile% & call :END
if errorlevel 4 echo Error Level 4 MISMATCHES >> %MyLogFile% & call :END
if errorlevel 3 echo Error Level 3 OKCOPY + XTRA >> %MyLogFile% & call :END
if errorlevel 2 echo Error Level 2 XTRA >> %MyLogFile% & call :END
if errorlevel 1 echo Error Level 1 OKCOPY >> %MyLogFile% & call :END
if errorlevel 0 echo Error Level 0 No Change >> %MyLogFile% & call :END

:END
echo Sync_Files Finished: %Date% %time% >> %MyLogFile%

echo ==================================================:  %Date% %time% >> %MyLogFile%
rename SR1171_Sync_Files.txt SR1171_Sync_Files_%date:~4,2%-%date:~7,2%-%date:~10,4%_At_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.txt
rename SR1171_Sync_Files_Log.txt SR1171_Sync_Files_Log_%date:~4,2%-%date:~7,2%-%date:~10,4%_At_%time:~0,2%h%time:~3,2%m%time:~6,2%s%.txt
0
Comment
Question by:eddiepardon
[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
1 Comment
 

Accepted Solution

by:
eddiepardon earned 0 total points
ID: 38819838
I found the problem... someway an extra % was added before the .txt
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
The way I use Experts Exchange to assist me in analyzing and diagnosing a problem is I first enter a Verbose Question at Experts Exchange like: Office 2007 will hang when opening and saving files I then launch WordPad (any text editor will do) an…
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…
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…

705 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