Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
String=ABCDE
Echo %String:~0,1%
This Returns "A"I want to substitute one or all of the numbers in the trim function with a predefined variable or another string.
(ie) lets assume I have a %Counter% string.
So If counter = 2If I was to substitute this into the above string It would look like this.
Echo %String:~0,%Counter%%
or
%String:~0,!Counter!%
The result you want is "AB", but the output can't be processed as the syntax of the way that the %counter% is entered is not correct.
Can you help me correct the syntax so that it can process the request?

Wrong forum. This has nothing to do with DOS.
=========================
@echo off & setLocal EnableDELAYedExpansionset str=ABCDE
set N=2
echo !str:~0,%N%!
=====================================
Helping others achieve escape felicityM2

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |