测试环境:windows10
直接上代码!
@echo off
setlocal enabledelayedexpansion
if not exist %temp%\12行星.txt (
echo 北交>%temp%\12行星.txt
echo 南交>>%temp%\12行星.txt
echo 太阳>>%temp%\12行星.txt
echo 月亮>>%temp%\12行星.txt
echo 水星>>%temp%\12行星.txt
echo 金星>>%temp%\12行星.txt
echo 火星>>%temp%\12行星.txt
echo 土星>>%temp%\12行星.txt
echo 木星>>%temp%\12行星.txt
echo 天王>>%temp%\12行星.txt
echo 海王>>%temp%\12行星.txt
echo 冥王>>%temp%\12行星.txt
)
if not exist %temp%\12星座.txt (
echo 白羊>%temp%\12星座.txt
echo 金牛>>%temp%\12星座.txt
echo 双子>>%temp%\12星座.txt
echo 巨蟹>>%temp%\12星座.txt
echo 狮子>>%temp%\12星座.txt
echo 处女>>%temp%\12星座.txt
echo 天秤>>%temp%\12星座.txt
echo 天蝎>>%temp%\12星座.txt
echo 射手>>%temp%\12星座.txt
echo 摩羯>>%temp%\12星座.txt
echo 水瓶>>%temp%\12星座.txt
echo 双鱼>>%temp%\12星座.txt
)
if not exist %temp%\12宫位.txt (
echo 1宫>%temp%\12宫位.txt
echo 2宫>>%temp%\12宫位.txt
echo 3宫>>%temp%\12宫位.txt
echo 4宫>>%temp%\12宫位.txt
echo 5宫>>%temp%\12宫位.txt
echo 6宫>>%temp%\12宫位.txt
echo 7宫>>%temp%\12宫位.txt
echo 8宫>>%temp%\12宫位.txt
echo 9宫>>%temp%\12宫位.txt
echo 10宫>>%temp%\12宫位.txt
echo 11宫>>%temp%\12宫位.txt
echo 12宫>>%temp%\12宫位.txt
)
set p=
set s=
set g=
for /L %%a in (1,1,50) DO (
set idx=1
set /a r=!random!%%12+1
for /f %%i in (%temp%\12行星.txt) do (
if "!r!" equ "!idx!" (
set p=%%i
)
set /a idx+=1
)
set idx=1
set /a r=!random!%%12+1
for /f %%j in (%temp%\12星座.txt) do (
if "!r!" equ "!idx!" (
set s=%%j
)
set /a idx+=1
)
set idx=1
set /a r=!random!%%12+1
for /f %%k in (%temp%\12宫位.txt) do (
if "!r!" equ "!idx!" (
set g=%%k
)
set /a idx+=1
)
echo !p!!s!!g!
for /L %%b in (1,1,1000) DO (
echo.>nul
)
cls
)
echo !p!!s!!g!
pause
exit