标题: [文件操作] 【已解决】如何改变BAT输出文本名 [打印本页]
作者: 思想之翼 时间: 2019-10-22 17:40 标题: 【已解决】如何改变BAT输出文本名
本帖最后由 思想之翼 于 2019-10-22 22:17 编辑
- @echo off
- set file="list.txt"
- set per=1
-
- for %%a in (%file%) do set "dpn=%%~dpna" & set "x=%%~xa"
- set /a count=per-1, n=0
- setlocal enabledelayedexpansion
- for /f "usebackq delims=" %%a in (!file!) do (
- set /a count+=1, n=count/per
- echo %%a>>"!dpn!!n!!x!"
- )
复制代码
上述代码将list.txt分割成若干文本,名称为list1 list2...欲使分割文本名为list0001 list0002...如何修改上述代码?
作者: Batcher 时间: 2019-10-22 20:35
回复 1# 思想之翼
@echo off
set file="list.txt"
set per=1
for %%a in (%file%) do set "dpn=%%~dpna" & set "x=%%~xa"
set /a count=per-1, n=0
setlocal enabledelayedexpansion
for /f "usebackq delims=" %%a in (!file!) do (
set /a count+=1, n=count/per
set suffix=1000!n!
echo %%a>>"!dpn!!suffix:~-4!!x!"
)
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |