1. 重定向
cmd >file standard output 重定向到file
cmd 1> nul 2>&1 无输出.
cmd 1> file 2>&1 standard output 重定向到file, standard error 重写向到 file.
cmd 1>> file 2>&1 standard output 重定向到file, standard error 重写向到 file. 均为追加模式。
2. findstr
findstr /NI /C:": error " file 在File中搜索字符串": error ", 不区分大小写
findstr /m /s /d:d:\ ".*" *.txt 搜索D盘下所有目录及子目录,显示所有match ".*"的txt文件的文件名
if %ERRORLEVEL% == 0 goto ERROR
3. if or not
if not exist folder md folder 如果不存在folder, 则创建folder
IF /I "%vv%"=="OK" (
...
) ELSE (
...
) 如果%vv%=="OK" (不区分大小写), 则...