刚接触批处理不久,自己动手写的一点小小的应用,希望大家喜欢。有失误的地方还请不要见笑!
不喜欢写代码的可下载附件,把后缀名改成bat就可直接运行。
代码如下:- @echo off
- mode con: cols=64 lines=26
- @title 关机程序 by:月下孤狐
- @color 2f
- Set L1= ╭══════════════════╮
- Set L2= ║ ║
- Set L3= ╭══┤ 实用关机程序 ├══╮
- Set L4= ║ ║ ║ ║
- Set L5= ║ ╰══════════════════╯ ║
- Set L6= ║ ║
- Set L7= ╟════════════════════════╢
- Set L8= ║ 版权所有:月下孤狐 仅供网友们交流 翻版不究 ║
- Set L9= ╰────────────────────────╯
- echo.
- echo.
- echo.
- :fox
- Echo.
- Echo %L1%
- Echo %L2%
- Echo %L3%
- Echo %L4%
- Echo %L5%
- Echo %L6%
- Echo ║ 请选择安装方式: ║
- Echo %L6%
- Echo ║ [1] 按[s]键关机 ║
- Echo ║ [2] 按[r]键重启 ║
- Echo ║ [3] 按[c]键取消关机 ║
- Echo ║ [4] 按[q]键退出 ║
- Echo %L6%
- Echo %L7%
- Echo %L8%
- Echo %L9%
- set /p a= 请选择你要进行的操作:
- if "%a%"=="s" goto :shutdown
- if "%a%"=="r" goto :restart
- if "%a%"=="c" shutdown -a &exit
- if "%a%"=="q" exit
- 您的输入有误,请重新输入!
- goto :fox
- :shutdown
- cls
- echo.
- echo.
- Echo %L1%
- Echo %L2%
- Echo %L3%
- Echo %L4%
- Echo %L5%
- Echo %L6%
- Echo %L7%
- Echo %L8%
- Echo %L9%
- set /p b= 请输入关机等待时间:单位(秒)
- if %b% lss 0 ( cls&echo. 您的输入有误,请重新输入!&goto :shutdown)
- if %b% gtr 9999 (cls&echo.您的输入有误,请重新输入! &goto :shutdown)
- shutdown -s -t %b% /c " 系统将在%b%妙后关机,请保存所有数据,关机原因是
- 用户自定义操作触发!"
- Exit
- :restart
- cls
- echo.
- echo.
- Echo %L1%
- Echo %L2%
- Echo %L3%
- Echo %L4%
- Echo %L5%
- Echo %L6%
- Echo %L7%
- Echo %L8%
- Echo %L9%
- set /p b= 请输入重启等待时间:单位(秒)
- if %b% lss 0 ( cls&echo. 您的输入有误,请重新输入!&goto :restart)
- if %b% gtr 9999 (cls&echo.您的输入有误,请重新输入! &goto :restart)
- shutdown -r -t %b% /c " 系统将在%b%妙后重启,请保存所有数据,关机原因是
- 用户自定义操作触发!"
- Exit
复制代码
|