我正在尝试开发一个 Windows 批处理程序,如果出现类似The system cannot find the drive specified.
或错误The system cannot find the path specified.
,则可以检查“fld_chk.out”文件并可能发生循环。
但是 cd A:\rr\Br>fld_chk.out 没有捕获这些错误。
如何捕捉那里的标准错误?
我的代码是这样的: -
cd A:\rr\Br>fld_chk.out
cd B:\yy\dd>>fld_chk.out
find /c "The system cannot find" *.out>fld_count_check_1.out
find /c "0" fld_count_check_1.out>fld_count_check_2.out
FOR /F "TOKENS=1* DELIMS=:" %%B IN (fld_count_check_2.out) DO SET b=%%C
set _count=%b%
IF %_count% EQU 2 goto Success
IF not %_count% EQU 2 goto notSuccess
:Success
echo folder found
:notSuccess
echo folder not found
在此先感谢