Yep. Just saw it. Thanks all. Got it working
From: [email protected] [mailto:[email protected]] On Behalf Of Andrew S. Baker Sent: Thursday, February 20, 2014 10:28 AM To: ntsysadm Subject: Re: [NTSysADM] setting month value in a dos batch A s MBS pointed out, you're truncating the %DATE% in the wrong place. Here are two easier ways to do this, without labels is: ECHO off SET MONTH2=%DATE:~4,2% IF "%MONTH2"=="01" SET MONTH3=Jan IF "%MONTH2"=="02" SET MONTH3=Feb IF "%MONTH2"=="03" SET MONTH3=Mar IF "%MONTH2"=="04" SET MONTH3=Apr IF "%MONTH2"=="05" SET MONTH3=May IF "%MONTH2"=="06" SET MONTH3=Jun IF "%MONTH2"=="07" SET MONTH3=Jul IF "%MONTH2"=="08" SET MONTH3=Aug IF "%MONTH2"=="09" SET MONTH3=Sep IF "%MONTH2"=="10" SET MONTH3=Oct IF "%MONTH2"=="11" SET MONTH3=Nov IF "%MONTH2"=="12" SET MONTH3=Dec 1: SETLOCAL ENABLEDELAYEDEXPANSION 2: SET MONTH2=%DATE:~4,2% 3: FOR %%M IN ("Jan 01" "Feb 02" "Mar 03" "Apr 04" "May 05" "Jun 06" "Jul 07" "Aug 08" "Sep 09" "Oct 10" "Nov 11" "Dec 12") DO ( 4: SET MMM=%%~M 5: IF "%MONTH2%"=="!MMM:~-2!" SET MONTH3=!MMM:~0,3! 6: ) Pay attention to the fact that there are only 6 lines in the second section. Also, you need that SETLOCAL command to make it as concise as possible. If someone has their regional settings different from yours, then this might not work. ASB http://XeeMe.com/AndrewBaker<http://xeeme.com/AndrewBaker> Providing Virtual CIO Services (IT Operations & Information Security) for the SMB market... On Thu, Feb 20, 2014 at 9:12 AM, David McSpadden <[email protected]<mailto:[email protected]>> wrote: set month2=%date:~0,2% if "%month2%" == "01" then goto :Jan elseif "%month2%" == "02" then goto :Feb elseif "%month2%" == "03" then goto :Mar elseif "%month2%" == "04" then goto :Apr elseif "%month2%" == "05" then goto :May elseif "%month2%" == "06" then goto :Jun elseif "%month2%" == "07" then goto :Jul elseif "%month2%" == "08" then goto :Aug elseif "%month2%" == "09" then goto :Sep elseif "%month2%" == "10" then goto :Oct elseif "%month2%" == "11" then goto :Nov elseif "%month2%" == "12" then goto :Dec goto :nextvar :Jan set month3="JAN" goto :nextvar :Feb set month3="FEB" goto :nextvar :Mar set month3="MAR" goto :nextvar :Apr set month3="APR" goto :nextvar :May set month3="MAY" goto :nextvar :Jun set month3="JUN" goto :nextvar :Jul set month3="JUL" goto :nextvar :Aug set month3="AUG" goto :nextvar :Sep set month3="SEP" goto :nextvar :Oct set month3="OCT" goto :nextvar :Nov set month3="NOV" goto :nextvar :Dec set month3="DEC" :nextvar set month3 Gives me nothing?? What am I missing? I should see month3=FEB But nothing is what I am getting? This e-mail and any files transmitted with it are property of Indiana Members Credit Union, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this email is strictly prohibited. Please consider the environment before printing this email. This e-mail and any files transmitted with it are property of Indiana Members Credit Union, are confidential, and are intended solely for the use of the individual or entity to whom this e-mail is addressed. If you are not one of the named recipient(s) or otherwise have reason to believe that you have received this message in error, please notify the sender and delete this message immediately from your computer. Any other use, retention, dissemination, forwarding, printing, or copying of this email is strictly prohibited. Please consider the environment before printing this email.

