嘿,我想知道批处理中的这个表达式代表什么,我试图绕过 uac,我需要将击键发送到 cmd 窗口,我看到一篇文章使用带有这个表达式的批处理代码,我不知道什么是如果有人可以解释我的功能,我将不胜感激!
继承代码:使用批处理文件按键盘键
@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));
它不是——它是 Jscript。
如果这个文件作为Jscript运行,那么由于会失败,那么和if之间的部分将不会被执行,而Jscript部分将被执行。@then@end
如果它作为批处理文件运行,则由于(@CodeSection不等于@Batch),该命令@then将不会被执行,因此该行后面的命令将被执行,最终到达跳过goto :eof文件其余部分的位置。
| 归档时间: | 
 | 
| 查看次数: | 2137 次 | 
| 最近记录: |