批处理脚本中途结束

时间:2016-11-15 05:38:33

标签: windows batch-file

我使用的是Windows 7 Professional。我在C:\ script中有以下文件。

TEXT_DIRECTION_RTL

log_email_clamav_daily_scan.bat

clamav_daily_scan.bat
log_email_clamav_daily_scan.bat
email.vbs
log.txt

当我在cmd上执行log_email_clamav_daily_scan.bat时,它只会停止,直到开始每日扫描。

@echo off
@echo set variables
SET DATETIME=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%%TIME:~0,2%%TIME:~3,2%%TIME:~6,2%%TIME:~9,2%
SET LOG_DIR="%PROGRAMFILES(X86)%"\ClamWin\bin\daily_scan\log
SET LOG_FILENAME=clamscanlog_%DATETIME%.txt

@echo start daily scan
C:\script\clamav_daily_scan.bat > %LOG_DIR%\%LOG_FILENAME%

@echo send result
C:\Windows\SysWOW64\cscript.exe C:\script\email.vbs %LOG_DIR%\%LOG_FILENAME%

1 个答案:

答案 0 :(得分:0)

使用

call C:\script\clamav_daily_scan.bat > %LOG_DIR%\%LOG_FILENAME%

没有call您的脚本将中途结束