Reputation: 665
I have assigned ip address to a variable in the following way.
set /A myvar = 10.0.0.1
echo %myvar%
but it is giving the result as only 10 not entire ip address.. so can some give the solution for it
Upvotes: 0
Views: 570
Reputation: 81
try this:
set myvar=10.0.0.1
echo %myvar%
The /A switch specifies that the string to the right of the equal sign is a numerical expression that is evaluated. The expression evaluator Note: no spaces around "=" sign
Upvotes: 2
Reputation: 42910
Get rid of the /A
, then it will work.
C:\>help set
[...]
The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated.
[...]
Upvotes: 1
Reputation: 123889
Just don't use /A
, its for numerical expressions
set myvar=10.0.0.1
echo %myvar%
//10.0.0.1
Upvotes: 1
Reputation: 8192
Can you put quotation marks around the ip address? "10.0.0.1"
Upvotes: 0