
关机定时的
@echo
off
shutdown
-s
-f
-t
XX
注:XX为数字表示秒!!
取消关机的
@echo
off
shutdown
-a
shutdownexe -s -f
f是强制关机
shutdownexe -a 取消关机
shutdownexe -s 关机
shutdownexe -f 强行关闭应用程序。
shutdownexe -m \计算机名 控制远程计算机。
shutdownexe -i 显示图形用户界面,但必须是Shutdown的第一个参数。
shutdownexe -l 注销当前用户。
shutdownexe -r 关机并重启。
shutdownexe -t 时间 设置关机倒计时。
shutdownexe -c"消息内容" 输入关机对话框中的消息内容(不能超127个字符)。
shutdownexe -h 休眠
1新建记事本 2键入如下代码: Dim mytime,myout1,myout2 mytime=null mytime=InputBox("请输入定时时间(格式20:10:05)"&vblf&"大概想倒计时关机,请输入倒计时时间"&vblf&"(单位/分钟)"&vblf&"输入‘xxx'可以马上关机"&vblf&"退出点‘取消'","定时关机","1") Set wshshell=wscriptcreateobject("wscriptshell") If IsNumeric(mytime)=False Then If IsDate(mytime)=True Then wshshellrun "at "&mytime&" shutdown -s" '定时关机在任务列表中 myout1=MsgBox("定时成功!电脑将在"&mytime&"关机!放弃关机请点‘取消'!",vbokcancel,"定时关机") If myout1=vbcancel Then wshshellrun "at /delete /y" MsgBox "关机已取消!",64,"定时关机" End If Else If mytime="xxx" Then wshshellrun "shutdown -s -t 0" End If MsgBox "输入错误!请重新输入!",64,"定时关机" End If Else If mytime>600 Or mytime<=0 Then MsgBox "输入错误!倒计时不能多于10小时(600分钟)!",64,"定时关机" wscriptquit End If wshshellrun "shutdown -s -t "&mytime60 myout2=MsgBox("设置成功!电脑将在"&mytime&"分钟后关机!放弃关机请点‘取消'!",vbokcancel,"定时关机") If myout2=vbcancel Then wshshellrun "shutdown -a" MsgBox "关机已取消!",64,"定时关机" End If End If 复制代码 代码如下: set diaolei=createobject("wscriptshell") dim shijian,guanji,hua shijian=time hua=inputbox("请输入你要用什么单位关机 1 代表分钟 2 代表小时 3 代表天") if hua=1 then guanji=inputbox("请输入你要几分钟后关机") if datediff("m",shijian,time)>=guanji then diaoleirun "rundll32exe userexe,exitwindows" diaoleirun "shutdown -s -t 0" elseif hua=2 then guanji=inputbox("请输入你要几小时后关机") if datediff("h",shijian,time)>=guanji then diaoleirun "rundll32exe userexe,exitwindows" diaoleirun "shutdown -s -t 0" elseif hua=3 then guanji=inputbox("请输入你要几天后关机") if datediff("d",shijian,time)>=guanji then diaoleirun "rundll32exe userexe,exitwindows" diaoleirun "shutdown -s -t 0" endif 3保存 4重命名为“定时关机vbs” 5双击运行
#include "stdafxh"
#include "processh"
int main()
{
system("at 1:02 shutdown -s -t 1");
}
调用系统命令,自动关机,延时一秒 定时1点02关机,时间随便改
程序依靠调用外部shutdown实现关机。
本例中定时100秒。
打开后计时,在DOS窗口按任意键停止
关机 *** 作。
你可以将100改为0,实现立即关机。
#include <stdioh>
#include <conioh>
void main(void)
{
system("shutdownexe -s -t 100");
getch();
system("shutdownexe -a");
}
不用写了,Windows里自带的有,具体 *** 作见下(如果觉得不好用,可以下载阿达自动关机,等关机软件
Windows XP的关机是由Shutdownexe程序来控制的,位于Windows\System32文件夹中。
比如你的电脑要在22:00关机,可以选择“开始→运行”,输入“at 22:00 Shutdown -s”,这样,到了22点电脑就会出现“系统关机”对话框,默认有30秒钟的倒计时并提示你保存工作。如果你想以倒计时的方式关机,可以输入“Shutdownexe -s -t 3600”,这里表示60分钟后自动关机,“3600”代表60分钟。
设置好自动关机后,如果想取消的话,可以在运行中输入“shutdown -a”。另外输入“shutdown -i”,则可以打开设置自动关机对话框,对自动关机进行设置。
Shutdownexe的参数,每个都具有特定的用途,执行每一个都会产生不同的效果,比如“-s”就表示关闭本地计算机,“-a”表示取消关机 *** 作,下面列出了更多参数,大家可以在Shutdownexe中按需使用。
-f:强行关闭应用程序
-m:\\计算机名:控制远程计算机
-i:显示图形用户界面,但必须是Shutdown的第一个选项
-l:注销当前用户
-r:关机并重启
-t:时间:设置关机倒计时
-c:“消息内容”:输入关机对话框中的消息内容(不能超127个字符)
以上就是关于bat高手帮我写一个关机的程序全部的内容,包括:bat高手帮我写一个关机的程序、自己写的关机程序要怎样才能强制关机、在电脑上怎样制作关机程序等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)