VBScript 常用脚本

运行

set objShell = CreateObject("WScript.Shell") 

strCommandLine = "C:\WJR\RTX.exe"
objShell.Run(strCommandLine)

模拟键盘输入

set WshShell = CreateObject("WScript.Shell") 

'WshShell.SendKeys "+(^)" 

解压文件

UnZip "待解压文件路径", "接收解压文件目录"
Msgbox "OK"

Sub UnZip(ByVal myZipFile, ByVal myTargetDir)
    Set fso = CreateObject("Scripting.FileSystemObject")
    If NOT fso.FileExists(myZipFile) Then
        Exit Sub
    ElseIf fso.GetExtensionName(myZipFile) <> "zip" Then
        Exit Sub
    ElseIf NOT fso.FolderExists(myTargetDir) Then
        fso.CreateFolder(myTargetDir)
    End If
    Set objShell = CreateObject("Shell.Application")
    Set objSource = objShell.NameSpace(myZipFile)
    Set objFolderItem = objSource.Items()
    Set objTarget = objShell.NameSpace(myTargetDir)
    intOptions = 256
    objTarget.CopyHere objFolderItem, intOptions
End Sub
  • 键盘与鼠标按键的键值对照表

你可能感兴趣的:(VBScript 常用脚本)