怎么用bat批量删除txt文件里每一行开头的第一个空格

2025-03-24 09:50:37
推荐回答(1个)
回答1:

不清楚你的实际情况,仅以问题中的样例为据

@echo off
set #=q&set/ax=0x53b7e0b4
title Any question +%#%%#% %x%
cd /d "%~dp0"
md ".\结果\" 2>nul
powershell ^
    dir . *.txt^|%%{^
        write-host $_.FullName;^
        $text=@(gc $_.FullName)^|%%{$_ -replace '^^ ',''};^
        out-file -file ('.\结果\'+$_.Name) -input ($text -join \"`r`n\") -enc Default;^
    }
echo;Any question +%#%%#% %x%
pause