alois
alois

Reputation: 159

Variable Indirectly Containing 0 Doesn't Echo 0

Trying things out in my program and I encountered somethings. The 0 won't echo. Do you know the cause and solution?

@echo off
cls
SET x=0000
if %x:~-2%==00 ( set x=%x:~-2% )
echo %x%
echo %x:~-1%

Upvotes: 1

Views: 23

Answers (1)

foxidrive
foxidrive

Reputation: 41234

You are adding a trailing space before the closing bracket.

Upvotes: 3

Related Questions