how to display single letter from one word [solved]

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

how to display single letter from one word [solved]

#1 Post by abc0502 » 03 May 2012 16:36

Is there a way i can get single letter from one word, let's say i have a txt file on my c drive called "test.txt" and in it there is one word "dostips" no i want to get let's say the 3rd letter to be displayed on the dos screen.
could that be done ?!
Last edited by abc0502 on 03 May 2012 16:53, edited 1 time in total.

Aacini
Expert
Posts: 1932
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: how to display single letter from one word

#2 Post by Aacini » 03 May 2012 16:39

Code: Select all

set /P word=< test.txt
echo %word:~3,1%

abc0502
Posts: 1007
Joined: 26 Oct 2011 22:38
Location: Egypt

Re: how to display single letter from one word

#3 Post by abc0502 » 03 May 2012 16:53

thank you Aacini, it worked
it displayed the fourth letter but i get the idea i change the 3 to 2 and it do the trick thanks :)

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: how to display single letter from one word [solved]

#4 Post by Squashman » 03 May 2012 19:43

Like many programming languages counting starts from 0.
Position 0 = D
Position 1 = o
Position 2 = s
Etc

Post Reply