Operation with number
Posted: 10 Sep 2013 02:26
Hello,
I have this problem, make sum and subtraction with variable
This is my code:
and this is the result:
what's wrong?
Thanks in advance and Regards
I have this problem, make sum and subtraction with variable
This is my code:
Code: Select all
@echo on &setlocal
for /f "delims=" %%A in ('wmic OS Get localdatetime ^| find "."') do set DATETIMEWMI=%%A
set Y=%DATETIMEWMI:~0,4%
set M=%DATETIMEWMI:~4,2%
set G=%DATETIMEWMI:~6,2%
IF %M%==01 (
SET Y=%Y%-1
SET M=12
) ELSE (
SET /a M=%M%-1)
and this is the result:
E:\for /F "delims=" %A in ('wmic OS Get localdatetime | find "."') do set DATETIMEWMI=%A
set DATETIMEWMI=20130910095309.879000+120
E:\set Y=2013
E:\set M=09
E:\set G=10
E:\echo Y=2013
Y=2013
E:\echo M=09
M=09
E:\echo G=10
G=10
E:\IF 09 == 01 (
SET /A Y=2013-1
SET /A M=12
) ELSE (SET /A M=09-1 )
Invalid number. Numeric constants are either decimal (17),
hexadecimal (0x11), or octal (021).
what's wrong?
Thanks in advance and Regards