批处理时:
Sub bat,批处理中因为不存在Sub,输出错误显示并跳过,在vbs中定义sub过程的name为bat
start wscript -e:vbs "%~f0",把整个批处理重新按vbs运行
Exit Sub,在vbs中从sub 过程中退出,在批处理中,只使用Exit,退出批处理
批处理也可以写成:
more +3<%~fs0>$.vbs
cscript //nologo $.vbs&del $.vbs
Exit
Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Dim WshShell,pa
Set WshShell = WScript.CreateObject("WScript.Shell")
Pa = WshShell.CurrentDirectory
set oShellLink = WshShell.CreateShortcut(strDesktop & "\火炬之光.lnk")
oShellLink.TargetPath = pa & "\开始游戏.exe"
oShellLink.WindowStyle = 2
oShellLink.IconLocation = pa & "\开始游戏.exe, 0"
oShellLink.WorkingDirectory = pa
oShellLink.Save
vbs:
Set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
Dim WshShell,pa
Set WshShell = WScript.CreateObject("WScript.Shell")
Pa = WshShell.CurrentDirectory
set oShellLink = WshShell.CreateShortcut(strDesktop & "\火炬之光.lnk")
oShellLink.TargetPath = pa & "\开始游戏.exe"
oShellLink.WindowStyle = 2
oShellLink.IconLocation = pa & "\开始游戏.exe, 0"
oShellLink.WorkingDirectory = pa
oShellLink.Save
[
Last edited by Hanyeguxing on 2010-6-15 at 12:01 ]