vbs转化成bat

来源:百度知道 编辑:UC知道 时间:2024/06/14 09:13:28
怎样把这段vbs改成bat文件?

on error resume next
dim WSHshellA
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 60 -c ""请在弹出的对话框中输入‘我是猪’并且点确定,否则我帮你关机,目前倒计时60秒,有种就别说"" ",0 ,true
dim a
do while(a <> "我是猪")
a = inputbox ("说我是猪,就不关机,快撒,说 ""我是猪"" ","www.hackstudy.cn"," 请输入“我是猪”并且点确定,终止关机倒计时",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
msgbox chr(13) + chr(13) + chr(13) + "早说就行了嘛"
dim WSHshell
set WSHshell = wscript.createobject("wscript.shell")
WSHshell.run "cmd.exe /c shutdown -a",0 ,true
msgbox chr(13) + chr(13) + chr(13) + "哈哈哈哈,真过瘾"

干嘛转换?窗口要怎样输入中文?????
这代码分成三部分
dim WSHshellA '声明变量 下同
set WSHshellA = wscript.createobject("wscript.shell")
WSHshellA.run "cmd.exe /c shutdown -r -t 60 -c ""请在弹出的对话框中输入‘我是猪’并且点确定,否则我帮你关机,目前倒计时60秒,有种就别说"" ",0 ,true
调用cmd外部命令 shutdown 倒计时关机 其实这样写就行了,不会有黑框闪过
WSHshellA.run "shutdown -r -t 60,ture"

关键部分
dim a
do while(a <> "我是猪")
a = inputbox ("说我是猪,就不关机,快撒,说 ""我是猪"" ","www.hackstudy.cn"," 请输入“我是猪”并且点确定,终止关机倒计时",8000,7000)
msgbox chr(13) + chr(13) + chr(13) + a,0,"MsgBox"
loop
msgbox chr(13) + chr(13) + chr(13) + "早说就行了嘛"

用 do loop 语句,当a 不等于"我是猪" loop 。
a = inputbox 输入框 当你输入"我是猪"也就是 a ="我是猪"
也就退出循环

接着运行 :run " shutdown -a",true