math - (Batch) Taking number from text file and minusing it -


hi im trying make simple batch game in free time , ran problem. want amount in text file minused x amount.

this part finds number in text file.

:money cls set "xprvar=" /f "skip=1 delims=" %%p in  (%userprofile%\variables.txt) (echo have %%p coin/s& goto break) goto coin  :break pause 

this part takes away x amount amount written in text file dosent want work , dont know how fix it.

:moneytaker set /a new=%money%-%%p echo = %new% pause 

doesn't work, because %%p no longer defined, when for loop finished. use variable instead:

for /f "skip=1 delims=" %%p in (%userprofile%\variables.txt) set coins=%%p echo have %coins% coin/s ... echo before: %money% set /a money-=coins echo after: %money% 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -