Batch file help - string manipulation

  • Thread starter Thread starter bru
  • Start date Start date
B

bru

I have a batch file script and I am trying to modify a SET
variable which has an 12 digits and I am trying to remove
the first two digits. Such as:
set XXX=991234567890
and I want to remove the "99" in front.

In the help for SET there is information about using /a
and logical shift (<<>>), but (1) I don't understand how to
use it and (2) whether this what I want.

Can anyone assist?
 
bru said:
I have a batch file script and I am trying to modify a SET
variable which has an 12 digits and I am trying to remove
the first two digits. Such as:
set XXX=991234567890
and I want to remove the "99" in front.

In the help for SET there is information about using /a
and logical shift (<<>>), but (1) I don't understand how to
use it and (2) whether this what I want.

Can anyone assist?

You need to look at the substring function:
@echo off
set XXX=991234567890
set YYY=%XXX:~3%
 
Pegasus said:
You need to look at the substring function:
@echo off
set XXX=991234567890
set YYY=%XXX:~3%

Cool! Didn't find it in Windows help, but
did find it using SET/?.

Many thanks!!!
 
Back
Top