与附加文字.BAT [英] Append text with .bat
问题描述
我想创建一个登录批处理文件处理的每一个操作和使用以下,但无济于事。我如何修复它(未创建的文件)?
REM>> C:\\VTS \\高级工具\\ SYSTEM \\ LOG \\高级工具%日期%.LOG
您需要使用 ECHO
。此外,把引号围绕整个文件路径,如果它包含空格。
另外一个说明,使用>
来覆盖文件(如果存在),或者创建,如果它不存在。使用>方式>
来追加到现有的文件或创建如果它不存在。
覆盖该文件以一个空行:
ECHO方式>C:\\我的文件夹\\ Myfile.log
追加一个空行到文件:
ECHO>方式>C:\\我的文件夹\\ Myfile.log
文字附加到文件:
ECHO一些文字和GT;>C:\\我的文件夹\\ Myfile.log
附加一个变量的文件:
ECHO%MY_VARIABLE%GT;>C:\\我的文件夹\\ Myfile.log
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:\"VTS\ADVANCED TOOLS\SYSTEM\LOG\Advanced tools %date%.log"
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.
Overwrite the file with a blank line:
ECHO.>"C:\My folder\Myfile.log"
Append a blank line to a file:
ECHO.>>"C:\My folder\Myfile.log"
Append text to a file:
ECHO Some text>>"C:\My folder\Myfile.log"
Append a variable to a file:
ECHO %MY_VARIABLE%>>"C:\My folder\Myfile.log"
这篇关于与附加文字.BAT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!