我想这样做:
@echo off
for %%x in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do (
ctext.exe {07} %%x
)
echo.
for %%y in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do (
ctext.exe {07}%%y
for %%x in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do (
ctext.exe {%%x%%y}%%x%%y
)
echo.
)
pause>nul
exit /b
进入一行,但如何在for循环后获取命令?
@echo off && for %%x in (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F) do ( ctext.exe {07} %%x ) <-- Here -->
我无法使用&&
,因为它在for循环中使用它。
答案 0 :(得分:2)
&&
和||
相当于基于上一个命令的错误级别的条件的then
else
部分。以下是
echo "test" | find "is" > nul
if errorlevel 1 (
echo not found
) else (
echo found
)
可以写成
echo "test" | find "is" >nul && echo found || echo not found
连接命令所需的是&
并放置一些括号以确保命令的分离
(for in () do ( a & b )) & (for in () do ( b & c ))