Skip to content

Instantly share code, notes, and snippets.

@xyuanmu
Last active March 31, 2021 07:35
Show Gist options
  • Save xyuanmu/15305359d6d47021c8aeafa1ccc8155a to your computer and use it in GitHub Desktop.
Save xyuanmu/15305359d6d47021c8aeafa1ccc8155a to your computer and use it in GitHub Desktop.
批处理奇偶运行不同代码
@echo off
setlocal enabledelayedexpansion
set n=0
:run
set /a n+=1
set /a x=!n! %% 2
if "!x!"=="1" (
echo.奇数
) else (
echo.偶数
)
if %n%==18 (
pause
) else (
call :run
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment