Question
April 1, 2008 at 10:22 PM
klr650r

Batch Files Number formating

by klr650r . Updated 18 years, 4 months ago

Hi,
I’ve got a problem with one of my batch files now, I only noticed this a few months after I started using it.

@ECHO OFF

:: —————————————————————
:: SETTING CURRENT DIRECTORY TO RECOVER OTHER FILES FROM

SET CURRDIR=%CD%

:: —————————————————————
:: LAST MONTHs INFO DELETE

:START
SET drive=F:
SET /a oldfp1=%date:~3,2% – 01
SET /a delfp2=%date:~6,4% – 1
SET /a delfp3=12
IF %oldfp1% EQU 0 SET delfolder=%date:~0,2%_%delfp3%_%delfp2%
IF %oldfp1% NEQ 0 SET delfolder=%date:~0,2%_%oldfp1%_%date:~6,4%
%drive%
IF EXIST %drive%\%delfolder% START %CURRDIR%\DELOLD.bat
pause

That last pause was added so I could see what was happening when I removed @ECHO OFF.

You can see a picture of this result here
http://i158.photobucket.com/albums/t109/klr650r/test.jpg

The IF EXIST F:\02_3_2008 should in fact say The IF EXIST F:\02_03_2008. The subtraction from the 04 (in 04-1, 01 was just one thing I tested) caused the number format to change to a single number.

Is there any way to keep my two number format after the subtraction ?

Any Help in the matter would be greatly appreciated.

Thanks,
Denis

This discussion is locked

All Comments