Use current month number in a batch file.

MDWinter
MDWinter used Ask the Experts™
on
Hi,

I have written a batch file which makes a call to an external file. As part of the call it sends two numbers, which represent a start month and an end month.

I want the batch file to send the CURRENT month number instead of a hard-coded value.

I've attached the code from the batch file - I want it such that if I run the file in February, the call will change from "Parm3:12" to "Parm3:2"

Thanks.
"D:\Visual CUt\Visual CUT.exe" -e "D:\Bulk Reports\reports\eom_statistics\manifestanlaysis.rpt" "Export_File:D:\Bulk Reports\Output\eom_statistics\Summary.pdf" "parm1:2010" "parm2:1" "parm3:12" "parm4:*" "parm5:*" "parm6:*" "parm7:LON" "parm8:EXB" "parm9:*" "parm10:*" "parm11:London Baggage" "parm12:*"

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Test your restores, not your backups...
Top Expert 2016
Commented:
This is a smple and safe way.

~bp
for /f "skip=1 tokens=2 delims=," %%A in ('WMIC Path Win32_LocalTime Get Month /Format:csv') do set Month=%%A
"D:\Visual CUt\Visual CUT.exe" -e "D:\Bulk Reports\reports\eom_statistics\manifestanlaysis.rpt" "Export_File:D:\Bulk Reports\Output\eom_statistics\Summary.pdf" "parm1:2010" "parm2:1" "parm3:%Month%" "parm4:*" "parm5:*" "parm6:*" "parm7:LON" "parm8:EXB" "parm9:*" "parm10:*" "parm11:London Baggage" "parm12:*"

Open in new window

Author

Commented:
Works perfectly - thanks.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial