Batch switches overriding profile report location

Avatar
  • updated
  • Answered
I'm writing a batch file that will instantiate wlexpert, and I would like the -r switch to override the settings in the profile.

Or perhaps there is a better way? I'm trying to run end of the month reports, and I would like to create a directory for the previous month. The %mm% value returns the current month, so I need to create a directory with the name %mm%-1 (and also adjust for when the reported month is 1 for month and year decrementing).

Any ideas?

This is what my batch file looks like, but the -r switch isn't overriding the report location specified in the profile setting.

@echo off
rem parse date
For /F "tokens=2,3,4 delims=/ " %%A in ('Date /t') do @(
Set Month=%%A
Set Day=%%B
Set Year=%%C
)

rem find last month
set /a Month=%Month%-1
if %Month% EQU 0 (SET Month=12)
rem find the last year
if %Month% EQU 0 (SET /a Year=%Year%-1)

if %Month% LSS 10 (SET Month=0%Month%)
if %Year% LSS 2010 (SET Year=200%Year%)

rem display date
:: @echo DAY = %Day%
:: @echo Month = %Month%
:: @echo Year = %Year%
:: pause

WLExpert ProfileName -n"Web Statistics" -r "S:\SharedLocation\Website_logs\%Month%%Year%" -t "Last month" -l "\\LogFileLocation\*.*"

Everything works except that the report location specified in the profile setting isn't being overriden by the -r switch directive.

Thanks

Chris
Avatar
chris alaska
Thank you very much for the fast reply. Your suggested approach worked very well, and made my life easier. Thanks.
Avatar
Michael
You need to remove space after the -r parameter (as well as -t and -l parameters) to make the program recognize the specified values.

However, in your case you don't need to use the batch file to set the output folder name depending on the current date. You just need to enter a path like S:\SharedLocation\Website_logs\%Date-1m%%mm%%yyyy% in the program settings (more information on the date macros is available in the program help).