我有以下代码,该代码访问特定站点并输入用户名(从%USERNAME%获取)。
只要将键盘设置为英语,它就可以正常工作,但是,如果将键盘设置为另一种语言,则不能正常工作。
是否有某种方法可以从批处理文件更改键盘输入语言或以其他方式解决此问题?
@if (@CodeSection == @Batch) @then
@echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
start chrome -new-window --incognito "https://servicedesk.sa.gov.ge/"
rem the script only works if the application in question is the active window. Set a timer to wait for it to load!
timeout /t 3
rem use the tab key to move the cursor to the login and password inputs. Most htmls interact nicely with the tab key being pressed to access quick links.
rem now you can have it send the actual username/password to input box
%SendKeys% "%USERNAME%"
%SendKeys% "{TAB}"
goto :EOF
@end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
答案 0 :(得分:0)
暂时,Windows不支持此功能,我也试图在超级用户上找到答案,但是目前尚无解决方案。