0

需要读取目录中的文件,跳过前77行后重写,用旧名称保存到新的txt文件。Diectory(还有比这更多的文件):

{1061A083-F913-4F7A-AEC4-E89BD7FEAC47}.html
{275A93DF-997B-4B2B-B5D6-C66302A03508}.html
{41579A2D-C022-44BE-9752-5407D241BBE2}.html
{47339F9D-AC59-433F-9FEB-1E818C7C1904}.html
{513E7E93-F6D5-4F1F-A905-28FE4D3DB30C}.html

我到目前为止的代码:

for /f "skip=7 delims=" %%a in ('dir /b *.html""') do (echo %%a>>newfile.txt)
xcopy newfile.txt C:\MBCNew\htmlFiles\Done\%%a.txt /y
del C:\MBCNew\htmlFiles\newfile.txt /f /q
4

1 回答 1

1

以下简单的批处理脚本非常高效(快速)。它将制表符转换为空格,但这对 HTML 来说应该不是问题。

@echo off
for /f "eol=: delims=" %%F in ('dir /b *.html') do (
  more +77 "%%F" >"%%F.new"
  move /y "%%F.new" "%%F"
)
于 2013-05-17T00:35:35.060 回答