需要编写批处理文件以执行以下命令(今天更新的列表文件详细信息):
D:\RMAN_BACKUP\BACKUP>FORFILES /D +12/12/2016 /C "cmd /c echo @fname is new today"
"test" is new today
"test.txt" is new today
我在下面编写代码来创建命令字符串,但无法通过批处理文件执行它:(。
cd D:/RMAN_BACKUP/BACKUP/
echo off
set str1=FORFILES /D
set str2=+%date:~4,2%/%date:~7,2%/%date:~10,4%
set str3=/C "cmd /c echo @fname is new today
set strnew=%str1% %str2% %str3%"
set strfi=echo.%strnew%
%strfi%
cmd.exe
使用新命令的新方法是合适的,只是尝试。
以下是我在批处理文件中执行上述代码时收到的输出:
C:\Users\SM\Desktop>d:
D:\>cd D:/RMAN_BACKUP/BACKUP/
D:\RMAN_BACKUP\BACKUP>echo off
FORFILES /D +12/12/2016 /C "cmd /c echo @fname is new today"
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
谢谢, SM