Batch File Subtraction

eDragon

Honorable
Feb 8, 2014
2
0
10,510
0
Hi, I'm trying to get into batch files, and I'm not sure how to simply subtract two numbers. The code is as follows:
echo How old are you?
set /p age=">>"
echo What year is it?
set /p year=">>"
set /a birthyear=%age%-%year%
echo So you were born in %birthyear%?
pause

However, when it shows %birthyear% its like -1985, I wasn't born in -1985! How do I fix this?
 

eDragon

Honorable
Feb 8, 2014
2
0
10,510
0


Thanks man, just simple math, I'm such a dufus.
 
Thread starter Similar threads Forum Replies Date
David___Only Apps General Discussion 0
S Apps General Discussion 4
M Apps General Discussion 3
D Apps General Discussion 2
N Apps General Discussion 1
NoctisLionward Apps General Discussion 2
malavena Apps General Discussion 3
Tom Waller Apps General Discussion 2
P Apps General Discussion 1
S Apps General Discussion 4
A Apps General Discussion 13
Z Apps General Discussion 1
P Apps General Discussion 7
G Apps General Discussion 0
T Apps General Discussion 5
SHADOWSTRIKE1 Apps General Discussion 3
S Apps General Discussion 3
R Apps General Discussion 3
P Apps General Discussion 2
M Apps General Discussion 3

ASK THE COMMUNITY