문제

I have this piece of batch file :

@echo off
set  xx=7
echo the version is %xx%

I wand to use it in a pre-build event in VS2010 - as an integer :

MY_INT = $(xx)

but it's value is a string , how can I convert the string value into an integer value in the batch file?

thanks!

도움이 되었습니까?

해결책

Environment variables (batch variables) are always strings; they cannot be stored as integers.

The SET command with the /A option can parse integral numbers from strings, perform arithmetic operations, and store the integral result in an environment variable. But the final result is still a string representation of the final number.

Type help set or set /? from a command prompt for more info about the SET /A option.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top