这是适用于Windows的split.bat脚本。我的问题是如何保存list1,list2而不是
list1-part1
list-part2
list-part3
这是我找到并试过的脚本。任何人都可以修改它吗?
@echo off
setLocal EnableDelayedExpansion
set file=%1
set limit=%2
set lineCounter=1
set filenameCounter=1
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
)
答案 0 :(得分:0)
只需更改此行set splitFile=!name!-part!filenameCounter!!extension!
到此set splitFile=!name!!filenameCounter!!extension!