且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

VBScript 发送键,尝试执行 CTRL+ALT+A

更新时间:2023-12-02 23:31:40

我现在使用 powershell,效果很好.使用 VBS,它工作一次,然后停止工作.这是我运行的代码:

I now use powershell and it work great. With VBS, it worked once and then it stoped working. This is the code I run:

[void][reflection.assembly]::loadwithpartialname("system.windows.forms")
[system.windows.forms.sendkeys]::sendwait("^%a")

我使用 PS2EXE 0.5.1 将脚本转换为 exe(SendKeys.exe),然后我从这段代码运行它:

I used PS2EXE 0.5.1 to convert the script to a exe (SendKeys.exe), then I run it from this code:

Set wshShell = WScript.CreateObject("WScript.Shell")
wshShell.run "C:LexibarSendKeys.exe",0

我需要从 vbs 运行它以避免弹出窗口.我使用 Vbs_To_exe 来转换这个,现在它可以工作了.(转换为 .exe 只是为了安全,对学生隐藏我的代码)

I need to run it from a vbs to avoid windows to pop. I used Vbs_To_exe to convert this one and now it work. (converting to .exe is just for security, hide my code from students)