编写批处理脚本以按"tab"和“输入"钥匙 [英] write a batch script to press "tab" and "Enter" key
问题描述
我需要使用批处理脚本或VB脚本按"TAB"和"Enter"键.
I need to press "TAB" and "Enter" key using either a batch script or VB script.
好的,我正在记事本中写入vb文件.我通过双击C:中的图标testVB.vbs来运行它. 这就是我所拥有的: testVB.vbs
OK, I'm writing the vb file in notepad. I run it by double clicking icon testVB.vbs in C:. This is what I have: testVB.vbs
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "test.bat"
WScript.Sleep 1000
WshShell.SendKeys (TAB) //to tab from the cancel button to open button
WScript.Sleep 1000
WshShell.SendKeys "~" //clicks open button
test.bat
@ECHO OFF
START MSAccess "C:\path\file.mdb"
我想打开Access和数据库,但是会出现一个弹出窗口,这是我要解决的问题.在弄清楚之后,我将需要弄清楚如何编写代码以将.txt文件导入数据库.
I want to open Access and the DB, but a pop up window appears which is what I'm trying to get around. After I figure that out I will need to figure out how to write code to import a .txt file to the DB.
TAB不能正常工作,我尝试了{TAB},"TAB",(TAB)和其他组合.我遇到第一个错误,其他人则没有任何动作.输入仍然有效(〜").
The TAB is what is not working, I have tried {TAB}, "TAB", (TAB), and different combos. I get an error with the first one and the others have no action. The enter works though ("~").
推荐答案
尝试一下;
@if (@CodeSection == @Batch) @then
@echo off
CScript //nologo //E:JScript "%~F0"
goto :EOF
@end
WScript.Sleep (1000)
WScript.CreateObject("WScript.Shell").SendKeys("{TAB}");
WScript.Sleep (1000)
WScript.CreateObject("WScript.Shell").SendKeys("~");
这篇关于编写批处理脚本以按"tab"和“输入"钥匙的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!