【发布时间】:2018-01-28 11:45:10
【问题描述】:
嘿,我想知道批处理中的这个表达式代表什么,我试图绕过 uac,我需要将击键发送到 cmd 窗口,我看到一个帖子使用带有这个表达式的批处理代码,我不知道如果有人能解释我不胜感激,它的功能是什么!
代码来自:Press Keyboard keys using a batch file
@if (@CodeSection == @Batch) @then
@echo off
rem Use %SendKeys% to send keys to the keyboard buffer
set SendKeys=CScript //nologo //E:JScript "%~F0"
rem Start the other program in the same Window
start "" /B cmd
%SendKeys% "echo off{ENTER}"
set /P "=Wait and send a command: " < NUL
ping -n 5 -w 1 127.0.0.1 > NUL
%SendKeys% "echo Hello, world!{ENTER}"
set /P "=Wait and send an Up Arrow key: [" < NUL
ping -n 5 -w 1 127.0.0.1 > NUL
%SendKeys% "{UP}"
set /P "=] Wait and send an Enter key:" < NUL
ping -n 5 -w 1 127.0.0.1 > NUL
%SendKeys% "{ENTER}"
%SendKeys% "exit{ENTER}"
goto :EOF
@end
// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.SendKeys(WScript.Arguments(0));
【问题讨论】:
-
这个帖子没什么问题,但既然是你的第一篇,你还没有这样做,请收下tour,阅读How to Ask和minimal reproducible example。
-
解释出现在您链接的同一答案中,在“有关此解决方案的进一步解释,请参阅:GnuWin32 openssl s_client conn to WebSphere MQ server not closing at EOF, hangs”之后。解释也在cmets...中进行了扩展
标签: batch-file