Link to home
Start Free TrialLog in
Avatar of deleyd
deleydFlag for United States of America

asked on

Extracting the last two digits of a number

set x=1234
@echo x=%x%
set result=%x:~-2%

Open in new window

My result is:
set x=1234
x=1234
set result=

and my result is blank.
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deleyd

ASKER

It's strange. The code did work fine, and now suddenly it's not. Must be something about my computer. I'll have a look.
Avatar of Bill Prew
Bill Prew

Can you post the actual script where that code is executing, maybe we can spot something that could cause a problem.

~bp
Avatar of deleyd

ASKER

I think it's actually a problem with my command prompt program.