Windows command to Read text file from specific position -
i trying write first batch file, hence simple question: have file (say "myfile.txt") has names of 10 cities in different rows. want print these names on command prompt 1 one, constraint don't want first 2 letters of city names displayed, how can it?
i tried following code not seem work:
/f "eol=: tokens=1" %%g in (myfile.txt) ( echo %%g:~2% )
you need temporarily copy line variable, , substring of that. you'll want enabledelayedexpansion
, change tokens * (for cities spaces in them). , turn echo off if want cities output.
@echo off setlocal enabledelayedexpansion /f "eol=: tokens=*" %%g in (myfile.txt) ( set line=%%g echo !line:~2! )
Comments
Post a Comment