PC Review


Reply
Thread Tools Rate Thread

Batch file help - string manipulation

 
 
bru
Guest
Posts: n/a
 
      6th Mar 2008
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?
 
Reply With Quote
 
 
 
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      6th Mar 2008

"bru" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>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%


 
Reply With Quote
 
bru
Guest
Posts: n/a
 
      6th Mar 2008
Pegasus (MVP) wrote:
> "bru" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>> 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%


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

Many thanks!!!
 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      6th Mar 2008

"bru" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Pegasus (MVP) wrote:
>> "bru" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>>> 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%

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


Thanks for the feedback.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DOS-Batch, How do I place a string at the end of a file. cozzmo1@hotmail.com Windows XP General 2 13th Apr 2009 08:38 PM
Reading a file using BufferedStream and avoiding String manipulation tourist.tam@googlemail.com Microsoft C# .NET 1 3rd Aug 2007 11:09 AM
q; Date to string in a batch file =?Utf-8?B?SklNLkgu?= Windows XP General 5 23rd Sep 2006 01:08 AM
Batch File For Tex Manipulation Carlton Noles Windows XP General 2 6th Feb 2006 06:46 PM
Concate String in Batch File sbubendorf@fargotank.com Windows XP Setup 2 29th Oct 2003 02:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:30 AM.