So in front of every line there should be [1] [2] and so on.
Thanks
[1]@echo off&setlocal
[2]set yfn=%1
[3]if not defined yfn echo Syntax : textify filename&echo (textifies
filename.bat to filename.txt)&goto :eof
[4]if not exist %yfn%.bat echo %yfn%.bat not found&goto :eof
[5]if not exist %yfn%.txt goto run
[6]set yyn=
[7]:ask
[8]set /p yyn=%yfn%.txt exists - overwrite
[9]if not defined yyn goto ask
[10]if /i %yyn%==Y goto run
[11]echo processing cancelled&goto :eof
[12]:run
[13]find /v /n "" <%yfn%.bat >%yfn%.txt
[14]dir %yfn%*
The secret is in line [13] The rest of the batch is for convenience.
[1]@echo off
[2]setlocal ENABLEDELAYEDEXPANSION
[3]cd /d %~dp0
[4]for %%a in ("%1") do set ext=%%~xa
[5]for %%a in ("%1") do set file=%%~na
[6]set yfn=%file%
[7]if not defined yfn echo Syntax : textify filename&echo (textifies
filename%ext% to filename.txt)%goto :eof
[8]if not exist %yfn%%ext% echo %yfn% not found&goto :eof
[9]if not exist %temp%\%yfn%.txt goto run
[10]set yyn=
[11]:ask
[12]set /p yyn=%yfn%.txt exists - overwrite
[13]if not defined yyn goto ask
[14]if /i %yyn%==Y goto run
[15]echo processing cancelled&goto :eof
[16]:run
[17]find /v /n "" <%yfn%%ext% >%temp%\%yfn%.txt
[18]notepad "%temp%\%yfn%.txt"
[19]del %temp%\%yfn%.txt
HTH
Matt
--
Posted via a free Usenet account from http://www.teranews.com
For those who prefer fixed-width line numbering,
type file.txt | COLS ^4,10001 * 1- > file.tx1
In DOS..Win98, the two filenames can be the same; in NT, XP, maybe not.
Limits : 255 characters per line, 2^31-1 lines, IIRC. COLS via sig.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQqish topics, acronyms & links.
PAS EXE TXT ZIP via <URL:http://www.merlyn.demon.co.uk/programs/00index.htm>.
Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)