标题: [文本处理] 批处理读取文本问题 [打印本页]
作者: qdlisan 时间: 2021-8-9 22:28 标题: 批处理读取文本问题
本帖最后由 qdlisan 于 2021-8-9 22:35 编辑
1.txt内容如下
某某 ^人人.exe
执行下面的批处理
for /f "delims=." %%i in (1.txt) do (
set index1=%%i)
echo %index1% > 2.txt
显示结果2.txt内容如下:
某某 人人
哪位大神回复一下 为什么不显示这个^符号呢 如果想输出“某某 ^人人”应该怎么写
作者: idwma 时间: 2021-8-9 22:37
- for /f "delims=." %%i in (F:\1.txt) do (
- set index1=%%i)
- echo %index1:^=^^% > 2.txt
复制代码
作者: Batcher 时间: 2021-8-9 22:37
回复 1# qdlisan - @echo off
- setlocal enabledelayedexpansion
- for /f "delims=." %%i in (1.txt) do (
- set "index1=%%i"
- )
- >2.txt echo,!index1!
复制代码
作者: Batcher 时间: 2021-8-9 22:40
回复 1# qdlisan - @echo off
- for /f "delims=" %%i in (1.txt) do (
- >2.txt echo,%%~ni
- )
复制代码
作者: qdlisan 时间: 2021-8-9 22:44
回复 2# idwma
这个不行
作者: qdlisan 时间: 2021-8-9 22:45
回复 4# Batcher
谢谢 成功了
作者: qdlisan 时间: 2021-8-9 22:45
回复 qdlisan
Batcher 发表于 2021-8-9 22:40
感谢
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |