Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using this in my program

for %%I in (*.txt) do (

The filenmae is in %%I.

Now i want to separate the first 2 chracters , next 3 characters , separately.

is it possible in DOS or Cmd.exe

share|improve this question

1 Answer 1

up vote 4 down vote accepted


set first2=%%I:~0,2% && set next3=%%I:~3,3%

I think.. geez, its been a while!

share|improve this answer
Thanks mate , it worked –  Mirage Feb 22 '10 at 6:20
+1 for the DosTips.com web site - cheers. –  Umber Ferrule Mar 11 '10 at 9:31

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.