Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
the following script allows the user to take a large txt file and break it up into smaller txt files:
@Echo Off
:: CTXT.BAT Syntax: CTxt [Unit:][PathName]FileName
:: Cut-down the specified file in pieces of 50 lines each
:: naming FileName_nn.ext starting from 01.
:: Win NT/2K/XP required; blanks not allowed in FNameIf not %1.==[]. (
Cmd /V:On /C Call %0 [] %1
GoTo :EOF)Shift
Echo.
If %1.==. (Echo File missing & GoTo :EOF)
If not exist %~f1 (
Echo File %~f1 not found
GoTo :EOF)Set Piece=50
Set Count=1
Set FileN=1
Set FileS=0!FileN!Echo Cutting-down %~f1 in pieces of !Piece! lines...
Echo.
If exist %~dpn1_*%~x1 Del %~dpn1_*%~x1For /F "tokens=* delims=" %%A in (%1) Do (
Echo %%A>> %~dpn1_!FileS!%~x1
Set /A Count=!Count!+1
If !Count! gtr !Piece! (
Set Count=1
Set /A FileN=!FileN!+1
Set FileS=!FileN!
If !FileS! lss 10 Set FileS=0!FileS!
)
)
Dir /B %~dpn1_*%~x1
Echo.
Echo Processing completed - !FileN! files writtenSet Count=
Set FileN=
Set FileS=
Set Piece=my question is what can i add to this script to prompt the user as follows:
how many lines do you want to use?
(it is set at 50)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |