Subtract month in Windows batch
<p>I would like to have this run and show the previous month. When I try to subtract the month it makes the last day of the month field not appear.</p>

<pre><code>@echo off

set FirstDay=01

set Month=%date:~4,2% 

set Year=%date:~10,4%



if %Month%==01 set LastDay=31 &amp; goto foundate
if %Month%==02 set LastDay=28 &amp; goto foundate
if %Month%==03 set LastDay=31 &amp; goto foundate
if %Month%==04 set LastDay=30 &amp; goto foundate
if %Month%==05 set LastDay=31 &amp; goto foundate
if %Month%==06 set LastDay=30 &amp; goto foundate
if %Month%==07 set LastDay=31 &amp; goto foundate
if %Month%==08 set LastDay=31 &amp; goto foundate
if %Month%==09 set LastDay=30 &amp; goto foundate
if %Month%==10 set LastDay=31 &amp; goto foundate
if %Month%==11 set LastDay=30 &amp; goto foundate
if %Month%==12 set LastDay=31 &amp; goto foundate



:foundate
echo The year is: %Year%
echo The month is: %Month%
echo First day of this month is: %FirstDay%
echo Last day of this month is: %LastDay%
</code></pre>