shell - VBScript 使用 SendKeys 发送新行的行为很奇怪
问题描述
我正在编写一个非常简单的 VBS 脚本,但遇到了一个非常奇怪的问题:
我最初使用的是这段代码:
Set wshShell=wscript.CreateObject("WScript.Shell")
WScript.Sleep(2000)
Dim i
i = 0
Dim val
val = 25
Do While i < 5
wshshell.SendKeys("What the")
WScript.Sleep(val)
wshshell.SendKeys("{ENTER}")
WScript.Sleep(val)
i = i + 1
Loop
但由于某种原因,输出是这样的:
What theWhat theWhat theWhat theWhat the
但是当我改变这个时:
wshshell.SendKeys("What the")
对此:
wshshell.SendKeys("What the ")
它工作正常并输出:
What the
What the
What the
What the
What the
是什么原因造成的?我对为什么会发生这种情况感到非常困惑。谢谢。
解决方案
推荐阅读
- sql-server - 提高 SQL 查询效率 - 尝试索引、游标和并行
- android - 不允许任何所有者撤销创建房间/MUC 的用户的所有权 - Ejabberd XMPP
- ffmpeg - 如何在没有音频同步问题的情况下使用 FFMPEG 连接多个 MP4 视频?
- c# - MatchEvaluator 对大小写不敏感的文本换行,除非文本在图像 HTML 标记内(但不忽略所有标记)
- webpack - Webpack 构建成功,但是没有退出就挂了
- python - 在系列中查找匹配项,不包括子字符串
- r - 为什么我没有在图表上获得日期作为我的标题?
- php - 在codeigniter中以递减的方式从数据库中获取数据
- three.js - 在保持相同位置的同时更改 3D 模型的父级
- mysql - MYSQL命令和phpmyadmin备份计划任务