|
Answer» My final result is to change a file name to includes TODAY's date. Fro one batch file I call another batch to set the date as follows: (dbname is database name) SET dbname=%1 cd X:\PUBLIC\SAP_AIX\performance_scripts\output date /T > todaysdate for /F "tokens=1-4 delims=/ " %a in (todaysdate) do set todaysdate=_%d%b%c rename %dbname%_current_SAP_DB_status.lst %dbname%_current_SAP_DB_status%todaysdate%.lst
The variable todaysdate should look like this: _20041213
When I type these commands from a command prompt, it works correctly. When I actually execute the batch file, I get the following ERROR when the date is sent to a file called todaysdate: X:>date /T 1>todaysdate dc was unexpected at this time. So now the for loop doesn't WORK??!!: X:>for /F "tokens=1-4 delims=/ " dc
Hi Jim, I found your post and wonder if you found the solution. I want to do something similar and it does not work.
Can you maybe help? Thanks Gabigabig, PLEASE don't bring back posts from 2004
if it wasn't answered 5 years ago. just leave itQuote from: Jim Crowley on December 14, 2004, 06:46:43 AM SET dbname=%1 cd X:\PUBLIC\SAP_AIX\performance_scripts\output date /T > todaysdate for /F "tokens=1-4 delims=/ " %a in (todaysdate) do set todaysdate=_%d%b%c rename %dbname%_current_SAP_DB_status.lst %dbname%_current_SAP_DB_status%todaysdate%.lst
@echo off set dbname=%1 cd X:\PUBLIC\SAP_AIX\performance_scripts\output for /f "tokens=2-4 delims=/ " %a in ('date /t') do set todaysdate=_%d%b%c rest of code here...
Should work, but I'm on a DSi, so I can't test it right now.It's been five years so I doubt he could test it either.
|