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 folderMyfile.log"
Append a blank line to a file:
ECHO.>>"C:My folderMyfile.log"
Append text to a file:
ECHO Some text>>"C:My folderMyfile.log"
Append a variable to a file:
ECHO %MY_VARIABLE%>>"C:My folderMyfile.log"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…