NirCmd-sendkeysendkeypress

news2024/10/24 4:54:24

引入script [Script File]

This command allows you to execute a sequence of commands stored inside the file specified in [Script File] parameter.
Example:
script "c:\temp\msg.ncl"
Example for a script:

infobox "Hello !" "This is the first message"
infobox "Hello !" "This is the second message"
infobox "Hello !" "This is the third message"

 使用该命令可以进行批处理(.txt,.bat,.ncl...)

nircmd script example.txt

sendkey [Key] [press | down | up]

 NirCmd Command Reference - sendkey (nirsoft.net)icon-default.png?t=O83Ahttp://nircmd.nirsoft.net/sendkey.html

​
Sends a keystroke to the system. The operating system will behave exactly as the user really pressed the specified keys.
The [Key] parameter specifies the key as virtual key code (For example: 0x2e for Delete key), or as one of the following predefined values:

a - z and 0 - 9 (for alphanumeric keys), F1 - F24 (for Fxx keys), shift, ctrl, alt, enter, esc ,leftshift, rightshift, leftctrl, rightctrl, leftmenu, rightmenu, spc (space), down, up, left, right, home, end, insert, delete, plus, comma, minus, period, lwin, rwin (Windows key), apps, pageup, pagedown, tab, multiply, add, subtract, seperator, divide, backspace, pause, capslock, numlock, scroll, printscreen.
The second parameter specifies the key action: 'press', 'down', or 'up'. For each key down action, you should also add the appropriate key up action.

In the following script example, the system behaves like the user presses Shift+Ctrl+Esc (the task manager should appear):
sendkey shift down
sendkey ctrl down
sendkey esc down
sendkey shift up
sendkey ctrl up
sendkey esc up

More examples:
sendkey a press
sendkey f10 press
sendkey enter press
sendkey 0x2e press

​

向系统发送一个按键操作。操作系统将完全模拟用户实际按下指定键的行为。

[Key] 参数指定了按键,可以使用虚拟键码(例如:0x2e 代表 Delete 键),或者使用以下预定义值之一:a - z 和 0 - 9(字母数字键)、F1 - F24(功能键)、shift、ctrl、alt、enter、esc、leftshift、rightshift、leftctrl、rightctrl、leftmenu、rightmenu、spc(空格)、down、up、left、right、home、end、insert、delete、plus、comma、minus、period、lwin、rwin(Windows 键)、apps、pageup、pagedown、tab、multiply、add、subtract、separator、divide、backspace、pause、capslock、numlock、scroll、printscreen。

第二个参数指定了按键动作:'press'、'down' 或 'up'。对于每个按下动作,你也应该添加相应的释放动作。

在下面的脚本示例(example.txt)中,系统表现得就像用户按下了 Shift+Ctrl+Esc(任务管理器应该出现):

nircmd script example.txt
sendkey shift down
sendkey ctrl down
sendkey esc down
sendkey shift up
sendkey ctrl up
sendkey esc up

 

能检测到虚拟按键 

更多示例:

sendkey a press
sendkey f10 press
sendkey enter press
sendkey 0x2e press

 

这些示例展示了如何使用sendkey命令模拟按键操作,可以用于自动化键盘输入任务。

sendkeypress [Keys Combination 1] [Keys Combination 2] [Keys Combination 3] ...

NirCmd Command Reference - sendkeypress (nirsoft.net)icon-default.png?t=O83Ahttp://nircmd.nirsoft.net/sendkeypress.html

​
Sends one or more key press combinations to the system. The operating system will behave exactly as the user really pressed the specified keys combination.
The [Key Combination] parameter specifies a single key press to send or a combination of a single key and shift/ctrl/alt/Windows keys, delimited by '+' character.
The key in the [Key Combination] parameter can be specifed as numeric virtual key code (For example: 0x2e for Delete key), or as one of the following predefined values: a - z and 0 - 9 (for alphanumeric keys), F1 - F24 (for Fxx keys), shift, ctrl, alt, enter, esc ,leftshift, rightshift, leftctrl, rightctrl, leftmenu, rightmenu, spc (space), down, up, left, right, home, end, insert, delete, plus, comma, minus, period, lwin, rwin (Windows key), apps, pageup, pagedown, tab, multiply, add, subtract, seperator, divide, backspace, pause, capslock, numlock, scroll, printscreen.

You can specify more than one [Key Combination] in a single sendkeypress command.

Here's some examples for using sendkeypress:

Send ctrl+shift+esc to show the task manager of Windows:
sendkeypress ctrl+shift+esc
Send ctrl+shift+esc to show the task manager of Windows and then move to the next window with alt+tab:
sendkeypress ctrl+shift+esc alt+tab
Switch the capslock mode:
sendkeypress capslock
Print 'Nir Sofer' to the current text editor in focus (The shift key combination is used to get the capital letters):
sendkeypress Shift+n i r spc shift+s o f e r
Save the current screen image into the clipboard (Ctrl+PrintScreen):
sendkeypress Ctrl+printscreen
Send Ctrl+Shift+K and then Ctrl+Shift+A and then Alt+Shift+P:
sendkeypress ctrl+shift+k ctrl+shift+a alt+shift+p
​

向系统发送一个或多个按键组合。操作系统将完全模拟用户实际按下指定的键组合的行为。

[Key Combination] 参数指定了要发送的单个按键或单个键与shift/ctrl/alt/Windows键的组合,组合键之间用 '+' 字符分隔。

在[Key Combination]参数中,键可以指定为数字虚拟键码(例如:0x2e代表Delete键),或者以下预定义值之一:a - z 和 0 - 9(字母数字键)、F1 - F24(功能键)、shift、ctrl、alt、enter、esc、leftshift、rightshift、leftctrl、rightctrl、leftmenu、rightmenu、spc(空格)、down、up、left、right、home、end、insert、delete、plus、comma、minus、period、lwin、rwin(Windows键)、apps、pageup、pagedown、tab、multiply、add、subtract、separator、divide、backspace、pause、capslock、numlock、scroll、printscreen。

你可以在单个sendkeypress命令中指定多个[Key Combination]。

以下是一些使用sendkeypress的例子:

显示Windows任务管理器(使用Ctrl+Shift+Esc):

sendkeypress ctrl+shift+esc

显示Windows任务管理器,然后使用Alt+Tab切换到下一个窗口:

sendkeypress ctrl+shift+esc alt+tab

切换大写锁定模式:

sendkeypress capslock

在当前聚焦的文本编辑器中打印"Nir Sofer"(使用Shift键组合来获取大写字母):

sendkeypress Shift+n i r spc shift+s o f e r

将当前屏幕图像保存到剪贴板(使用Ctrl+PrintScreen):

sendkeypress Ctrl+printscreen

发送Ctrl+Shift+K,然后Ctrl+Shift+A,然后Alt+Shift+P:

sendkeypress ctrl+shift+k ctrl+shift+a alt+shift+p

这些示例展示了如何使用sendkeypress命令来模拟复杂的键盘操作,这对于自动化任务非常有用。

单纯想实现自动化按键可以用python的pyautogui库

侵删

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2211010.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

微知-如何查看服务器CPU当前运行主频?(cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq)

关键命令 cat /sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq背景 首先lscpu可以查看到有多个cpu,里面也会显示cpu的频率,但是这里显示仅仅是规格,不是实际值。为了查看实际值,需要到/sys文件系统中查看,也…

大数据-167 ELK Elasticsearch 详细介绍 特点 分片 查询

点一下关注吧!!!非常感谢!!持续更新!!! 目前已经更新到了: Hadoop(已更完)HDFS(已更完)MapReduce(已更完&am…

ARIMA 模型初体验 —— 预测股票数据

第 1 步,从 twelvedata 上获取苹果 11 号 15:30 到 16:00 的 OHLC、成交量 数据。 第 2 步,编写 Python 代码(实际上可以用 R 语言,R 语言从语言的级别对分析预测提供了支持,而 Python 需要第三方库)。 …

Yolov8 搭配 Frequency-aware Feature Fusion for Dense Image Prediction

个人觉得论文赞的地方 https://github.com/Linwei-Chen/FreqFusion https://www.arxiv.org/abs/2408.12879 因为我有个项目需要训练边界模糊的情况,但又需要目标能在模糊里凸显出来,就是看到这张图以后觉得很赞,边界变得清晰有特征是我想要的,所以尝试用了 使后感 哈哈…

【CSS3】css开篇基础(2)

1.❤️❤️前言~🥳🎉🎉🎉 Hello, Hello~ 亲爱的朋友们👋👋,这里是E绵绵呀✍️✍️。 如果你喜欢这篇文章,请别吝啬你的点赞❤️❤️和收藏📖📖。如果你对我的…

数据结构-5.2.树的性质

一.树的常考性质: 性质1:结点数 总度数 1(结点的度:结点分支的数量) 一个分支中,如父结点B,两个子结点为E和F,结点B的度的值为2,等于子结点数量,加上这一个父结点(父结点只能有一…

【计算机网络 - 基础问题】每日 3 题(三十九)

✍个人博客:https://blog.csdn.net/Newin2020?typeblog 📣专栏地址:http://t.csdnimg.cn/fYaBd 📚专栏简介:在这个专栏中,我将会分享 C 面试中常见的面试题给大家~ ❤️如果有收获的话,欢迎点赞…

大型语言模型(LLMs)关键技术指南

在AI这个超火的领域,打好基础真的超级重要,尤其是当你开始研究那些超大型的语言模型,也就是LLMs的时候。这个指南就是想帮新手们把那些听起来高大上的概念变得简单易懂,比如神经网络、自然语言处理(NLP)还有…

【ROS2实操一】话题通信与自定义消息

一、准备工作 1.请先创建工作空间 mkdir -p ws01_plumbing/src //创建工作空间 colcon build //在工作空间目录下编译 2.创建专门的接口功能包定义接口文件(需要注意的是,目前为止无法在Python功能包中定义接口文件),终端下进…

线程基础学习

线程的实现 通过实现Runnable接口的方式,实现其中的run方法。继承Thread类,然后重写其中的run方法。通过线程池创建线程,默认采用DefaultThreadFactory。有返回值的callable,实现callable接口,实行call方法。 本质上…

wait和waitpid

在Linux中,wait 和 waitpid 是用于进程控制的系统调用,它们主要用来让父进程等待子进程的终止,并获取子进程的退出状态。下面详细介绍它们的用法和区别。 1. wait() 函数 wait() 会阻塞调用进程,直到一个子进程终止。它的典型用…

怎么ping网络ip地址通不通

怎么Ping网络IP地址通不通?要检查网络中的IP地址是否连通,可以使用‌Ping命令。Ping命令通过发送ICMP(Internet Control Message Protocol,因特网控制消息协议)Echo请求报文并等待回应,来判断目标主机是否可…

ARP限制网速攻击

ARP限制网速攻击 大家没想到吧,ARP还能限制对方网速。当kali欺骗了网关和受害者的时候,受害者访问网络就需要经过kali的网卡,那我们限制kali网卡的速度或者转发的速度就可以限制对方的网速。这里可以使用的工具有tc、iptables、WonderShaper…

Unix Standardization and Implementations

Unix标准化 在Unix未制定较为完备的标准时,各个平台的系统调用方式各异,所开发出的应用程序存在可移植性差的特点,因此人们呼吁指定一套Unix标准来规范接口,增加应用程序的可移植性。所谓Unix标准即适用于Unix环境下的一系列函数…

AI 时代技术盛宴 —— 稀土掘金 × 豆包 MarsCode 青训营等你来!

各位 CSDN 的小伙伴们,今天我要给大家带来一个超级棒的消息!稀土掘金与豆包 MarsCode 强强联手,共同打造的青训营再次上线啦! 在这个飞速发展的 AI 时代,这场青训营玩出了不一样的精彩。它携手 AI 伙伴豆包 MarsCode&…

一个项目用5款数据库?MySQL、PostgreSQL、ClickHouse、MongoDB区别,适用场景

文章目录 一、常用数据库概览1.1 关系型数据库1.2 非关系型数据库1.2.1 KV数据库1.2.2 文档型数据库1.2.3 列式存储数据库1.2.4 图数据库 1.3 SQL与NoSQL区别1.3.1 结构化与非结构化1.3.2 关联和非关联1.3.3 查询方式1.3.4 事务1.3.5 总结 二、MySQL三、PostgreSQL3.1 特点、适…

计组_中断响应条件

2024.10.13:计算机组成原理学习笔记 中断响应条件 条件1:CPU要处于开中断状态条件2:至少要有一个未被屏蔽的中断请求屏蔽?中断优先级屏蔽字的作用 条件3:当前指令刚执行完 条件1:CPU要处于开中断状态 当CP…

Redis:分布式 - 主从复制

Redis:分布式 - 主从复制 概念配置主从模式info replicationslave-read-onlytcp-nodelay 命令slaveof 主从结构一主一从一主多从 主从复制流程数据同步命令全量同步部分同步实时同步 节点晋升 概念 Redis的最佳应用,还是要在分布式系统中。对于非分布式…

如何解决 Vim 中的 “E212: Can‘t open file for writing“ 错误:从编辑到权限管理(sudo)

个人名片 🎓作者简介:java领域优质创作者 🌐个人主页:码农阿豪 📞工作室:新空间代码工作室(提供各种软件服务) 💌个人邮箱:[2435024119qq.com] &#x1f4f1…

Squad战术小队开服教程

1、登录服务器(百度莱卡云游戏面板) 登录面板的信息在绿色的登陆面板按键下方,不是你的莱卡云账号 进入控制面板后会出现正在安装的界面,大约10分钟左右就能安装完成 2、设置 点击目录上的网络,你可以看到三个端口 然…