小编Ann*_*ond的帖子

ECHO 已关闭附加到文本文件

我在批处理文件中有以下代码:

rem capture the date/time(right down to the second) and then assign it to a variable
set yy=%date:~-4%
set dd=%date:~-7,2%
set mm=%date:~-10,2%
set newdate=%dd%%mm%%yy%_%Time:~0,8%
set newdate=%newdate::=%
set foldername=svetlana_backup_%newdate%
set foldername=%foldername: =%

set destination=R:\Backup

if exist %destination% (
    rem do stuff if destination exists.
) else (
    call:GenerateErrorLog "%destination% not found."
)


:GenerateErrorLog
echo %~1 >> error_log_%foldername%.txt
goto:eof
Run Code Online (Sandbox Code Playgroud)

它生成以下文本文件:

R:\Backup not found. 
ECHO is off.
Run Code Online (Sandbox Code Playgroud)

为什么它打印 ECHO is off,如何防止它?

command-line cmd batch-file

0
推荐指数
1
解决办法
734
查看次数

标签 统计

batch-file ×1

cmd ×1

command-line ×1