Batch file help - string manipulation

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?
 
P

Pegasus \(MVP\)

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%
 
B

bru

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!!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top