You are on page 1of 1

@echo off

setLocal EnableDelayedExpansion

set /P file=Enter File Name:


set lineCounter=1
set filenameCounter=1

SET count=1
FOR /f "tokens=*" %%G IN (%file%) DO (
echo %count%:%1
set /a count+=1
)

set /a limit=(count-1)/2

echo %limit%

set name=
set extension=
for %%a in (%file%) do (
set "name=%%~na"
set "extension=%%~xa"
)

for /f "tokens=*" %%a in (%file%) do (


set splitFile=!name!-part!filenameCounter!!extension!
if !lineCounter! gtr !limit! (
set /a filenameCounter=!filenameCounter! + 1
set lineCounter=1
echo Created !splitFile!.
)
echo %%a>> !splitFile!

set /a lineCounter=!lineCounter! + 1
)