使用 .bat 附加文本 [英] Append text with .bat

查看:23
本文介绍了使用 .bat 附加文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为批处理文件中处理的每个操作创建日志,并使用以下内容但无济于事.我该如何解决(文件未创建)?

I want to create a log of every operation processed in a batch file and used the following but to no avail. How do I fix it (the file was not created)?

REM>> C:"VTSADVANCED TOOLSSYSTEMLOGAdvanced tools %date%.log"

推荐答案

您需要使用 ECHO.此外,如果包含空格,请在整个文件路径周围加上引号.

You need to use ECHO. Also, put the quotes around the entire file path if it contains spaces.

另一个注意事项,使用 > 覆盖文件(如果存在)或创建(如果不存在).使用 >> 附加到现有文件,如果不存在则创建.

One other note, use > to overwrite a file if it exists or create if it does not exist. Use >> to append to an existing file or create if it does not exist.

用空行覆盖文件:

ECHO.>"C:My folderMyfile.log"

在文件中添加一个空行:

Append a blank line to a file:

ECHO.>>"C:My folderMyfile.log"

将文本附加到文件:

ECHO Some text>>"C:My folderMyfile.log"

将变量附加到文件中:

ECHO %MY_VARIABLE%>>"C:My folderMyfile.log"

这篇关于使用 .bat 附加文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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