【VBS脚本教程】:写入记事本文件及输出

代码

Dim wshshell
set wshshell = createobject("wscript.shell")
wshshell.run "notepad"
wscript.sleep 1500
wshshell.appactivate "成功"
wshshell.sendkeys "happy birthday!!!"
wscript.sleep 500
wshshell.sendkeys "%FS"
wscript.sleep 500
wshshell.sendkeys " birth.txt"  '这里一定要先空一个格,因为系统默认会吃掉第一个字符
wscript.sleep 500
wshshell.sendkeys "%s"
wscript.sleep 500
wshshell.sendkeys "%FX"

sendkeys都是模拟了键盘的操作
因为传输字符需要时间,所以需要sleep一下

你可能感兴趣的:(代码,脚本,vbs)