尝试使用批处理将HTML从一个文件复制到另一个文件 [英] Trying to copy HTML from one file to another using batch

查看:51
本文介绍了尝试使用批处理将HTML从一个文件复制到另一个文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过Batch处理一些HTML,但是即使我已经 setlocal enableDelayedExpansion ,它仍然不会传输标签.这是我的脚本:

I'm manipulating some HTML via Batch but even though I've setlocal enableDelayedExpansion, it still won't transfer tags. This is my script:

@echo off
setlocal enableDelayedExpansion
del output.html
for /f "delims=" %%x in (file.html) do call :putLineInHTMLFile %%x
:putLineInHTMLFile
echo !%*!>> output.html

file.html包含:

file.html contains:

<tag 1>
<tag 2>

运行脚本后,output.html包含:

After running the script, output.html contains:

ECHO is off.

P.S .:我想继续使用 do call ,所以我对一个能使这项工作有效而又不删除 do call 语句的答案很感兴趣.

P.S.: I would like to keep using do call so I'm interested in an answer that makes this work without removing the do call statement.

推荐答案

@echo off
setlocal enableDelayedExpansion
del output.html
for /f "delims=" %%x in (file.html) do call :putLineInHTMLFile "%%x"
goto :EOF

:putLineInHTMLFile
set "line=%~1"
echo !line!>> output.html

这篇关于尝试使用批处理将HTML从一个文件复制到另一个文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆