windows下bat批处理根据输入年月日输出属相和星座

来源:互联网 发布:vue写的案例源码 编辑:程序博客网 时间:2024/05/03 11:21
@echo offsetlocal enabledelayedexpansiontitle=算命大师set shengxiao=猴鸡狗猪鼠牛虎兔龙蛇马羊:startset /p birthday=请输入出生年月日(如19970731):if %birthday:~0,1%==0 (set /a year=%birthday:~1,3%) else (set /a year=%birthday:~0,4%)if %birthday:~4,1%==0 (set /a month=%birthday:~5,1%) else (set /a month=%birthday:~4,2%)if %birthday:~6,1%==0 (set /a day=%birthday:~7,1%) else (set /a day=%birthday:~6,2%)if %month% gtr 13 (echo 请输入正确的月份 & goto end)if %day% gtr 32 (echo 请输入正确的日期 & goto end)set /a yy=%year%%%12echo 你属!shengxiao:~%yy%,1!if %birthday:~4,1%==0 (set /a monthAndDay=%birthday:~5,3%) else (set /a monthAndDay=%birthday:~4,4%)if %monthAndDay% leq 119 echo 摩羯座 & goto endif %monthAndDay% leq 218 echo 水瓶座 & goto endif %monthAndDay% leq 320 echo 双鱼座 & goto endif %monthAndDay% leq 420 echo 白羊座 & goto endif %monthAndDay% leq 520 echo 金牛座 & goto endif %monthAndDay% leq 621 echo 双子座 & goto endif %monthAndDay% leq 722 echo 巨蟹座 & goto endif %monthAndDay% leq 822 echo 狮子座 & goto endif %monthAndDay% leq 922 echo 处女座 & goto endif %monthAndDay% leq 1022 echo 天秤座 & goto endif %monthAndDay% leq 1121 echo 天蝎座 & goto endif %monthAndDay% leq 1221 echo 射手座 & goto endif %monthAndDay% gtr 1221 echo 摩羯座 & goto end:endpausegoto start


运行效果截图如下:


0 0
原创粉丝点击