Path and Filename in Parameter
Posted: 18 Dec 2009 08:19
Well this is my first post on the Forum and I hope that you will be able to help me out.
I have used DOS batch files in the past to run MS-Access macros for scheduled reports.
I want to create a log file out of my batch run in order to track when each step is Started and Completed. I am using an Echo statement and a Redirect Append >> to accomplish this.
Here is where my issue comes into play... My log file I want to store on a server within a specific path and I want the file to contain the current date. That way each file name is unique for each days run. I don't want to have to retype the path each time so I want to use a parameter, but I am having issues with setting it dynamically and then using it in the redirection.
Code:
set date2=%date:~4,2%%date:~7,2%%date:~10,4%
set FileLoc=S:\OPRCONSN\Reports and Tools\Scheduled\DailyMainBatchLogs\BatchLogFile%date2%.txt
echo %time% Step1 Complete>>@FileLoc@
my output goes to:
- path is the same location as my batch file. Which is different than where my path is set for Parameter FileLoc
- output redirection name file is @FileLoc@ instead of BatchLogFile12182009.txt
Any direction would be greatly appreciated.
Thanks
I have used DOS batch files in the past to run MS-Access macros for scheduled reports.
I want to create a log file out of my batch run in order to track when each step is Started and Completed. I am using an Echo statement and a Redirect Append >> to accomplish this.
Here is where my issue comes into play... My log file I want to store on a server within a specific path and I want the file to contain the current date. That way each file name is unique for each days run. I don't want to have to retype the path each time so I want to use a parameter, but I am having issues with setting it dynamically and then using it in the redirection.
Code:
set date2=%date:~4,2%%date:~7,2%%date:~10,4%
set FileLoc=S:\OPRCONSN\Reports and Tools\Scheduled\DailyMainBatchLogs\BatchLogFile%date2%.txt
echo %time% Step1 Complete>>@FileLoc@
my output goes to:
- path is the same location as my batch file. Which is different than where my path is set for Parameter FileLoc
- output redirection name file is @FileLoc@ instead of BatchLogFile12182009.txt
Any direction would be greatly appreciated.
Thanks