联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!
'HIDECMD.VBS BY: fastslz http://bbs.cn-dos.net 2007-01-03 '隐藏批处理运行窗口本身就是风险代码,如果你很菜请离开此页! Usage1 = "请将批处理文件Bat、Cmd拖放到此文件上" Usage2 = "命令语法1: HIDECMD.VBS ""D:\Test.bat""" Usage3 = "命令语法2: HIDECMD.VBS /M ""D:\Test1.bat"" ""D:\Test2.bat"" " Usage4 = "隐藏批处理运行窗口工具" Options = "/M" set objShell = CreateObject ("Wscript.Shell") set BatFile = WScript.Arguments if BatFile.Count = 0 Then MsgBox Usage1 &vbCrLf& Usage2 &vbCrLf& Usage3, 4096+vbInformation, Usage4 Wscript.Quit(0) end if if BatFile.Count > 1 Then ignoring = StrComp(BatFile(0), Options, vbTextCompare) if ignoring = 0 Then For I = 1 To BatFile.Count - 1 MultiBat = BatFile(I) Call RunBat(MultiBat) Next Wscript.Quit(0) else objShell.Popup "参数太多或语法错误!"&vbCrLf&"此提示框在5秒后自动退出 ",5, "程序意外终止" Wscript.Quit(0) end if end if MultiBat=BatFile(0) Call RunBat(MultiBat) Wscript.Quit(0) Function RunBat(MultiBat) BatTmp=split(MultiBat,"\") BatName=BatTmp(UBound(BatTmp)) ignoring = StrComp(MultiBat, BatName, vbTextCompare) if ignoring = 0 Then BatPath=left(Wscript.ScriptFullName,len(Wscript.ScriptFullName)-len(Wscript.ScriptName)) else BatPath=Left(MultiBat,Len(MultiBat)-Len(BatName)) end if objShell.CurrentDirectory=BatPath objShell.Run ("%Comspec% /c "&Chr(34)&BatPath&BatName&Chr(34)),vbHide End Function
D:\1 1.bat内容 @echo off echo %~f0 pause