标题: [文本处理] 批处理set files 一行太长了,怎样折行? [打印本页]
作者: oyr520 时间: 2022-1-8 12:02 标题: 批处理set files 一行太长了,怎样折行?
set files="test.bin" "test2.bin" "note.txt" "ext" "release_rar" "release_rar2" "release_rar3" "doc" "release_rar5"
set com=".\custom\project\abc\include\com.h"
想要下面这样的效果
set files="test.bin" "test2.bin" "note.txt" "ext"
"release_rar" "release_rar2"
"release_rar3" "doc" "release_rar5"
set com=".\custom\project\abc\include\com.h"
作者: went 时间: 2022-1-8 13:13
- @echo off & cd /d "%~dp0"
-
- set files="test.bin" "test2.bin" "note.txt" "ext"
- set files=%files% "release_rar" "release_rar2"
- set files=%files% "release_rar3" "doc" "release_rar5"
-
- set com=".\custom\project\abc\include\com.h"
-
- echo %files%
- echo %com%
- pause&exit
复制代码
作者: Nsqs 时间: 2022-1-8 16:17
本帖最后由 Nsqs 于 2022-1-8 16:33 编辑
这要是怕麻烦那就干脆不要写代码了- @echo off
- for /f "tokens=1 delims=:" %%1 in ('findstr /ni "^::data$" "%~0"')do (
- set count=%%1
- )
-
- for /f "delims=" %%1 in ('more +%count%^<"%~0"')do (
- call set file=%%file%% %%1
- )
- echo %file%
- pause
-
-
-
-
- goto :eof
- ::data
-
- "test.bin" "test2.bin" "note.txt" "ext"
- "release_rar" "release_rar2" "release_rar3"
- "doc" "release_rar5"
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |