批处理脚本删除文本文件中的字符

时间:2017-05-08 19:17:33

标签: batch-file

我有一个文本文件,我需要在离开90后删除字符,我正在寻找自动化,请帮忙!

H0000300000011060040517171959
第1行:D41799771000000011550000000370004871700001 CHARLEYS加油底座 1234567898-03052017

第2行:D41799771000000011440000000496007091700001WALLSTREET 1234567740-01052017

第3行:D4179977100000001155000000022232323251700001KFC 1234568476-03052017

@echo off
setlocal enabledelayedexpansion
for /f "delims=" %%a in (test.txt) do (
    set "line=%%a"
    set "line=!line:~0,-91!"
    echo !line! ) > list.txt 

1 个答案:

答案 0 :(得分:0)

如果你想要90个字符:

set "line=!line:~,90!"

我不知道你为什么要把-91放在那里?

语法为:

![VARIABLE]:~,[Stop after this many characters]!