什么是VBS
Win7环境确认
cscript
验证创建脚本文件
MsgBox "Hello World!", vbInformation, "我的第一个VBS"
常用基础语法
Dim varName
InputBox
/MsgBox
文件操作
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "C:\test.txt", "D:\backup\"
系统管理
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "shutdown -s -t 60"
注册表操作
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegWrite "HKCU\Software\MyApp\Version", "1.0", "REG_SZ"
脚本无法运行
权限问题
调试技巧
//X
参数启动调试WScript.Echo
输出变量