nircmd - 强大windows命令行工具之鼠标操作

nircmd是windows一个强大小巧精悍的命令行工具;

这篇文章只介绍使用nircmd才完成操作鼠标常用的方法:

鼠标命名操作方法

sendmouse [right | left | middle] [down | up | click | dblclick]

sendmouse [move] [x] [y]

sendmouse [wheel] [Wheel Value]

Sends the specified mouse event to the system. The operating system will behave exactly as the user really made the specified mouse action.
Heres some example of sendmouse command:
Sent a right click (For most applications, a context menu is opened):
sendmouse right click
Sent a double-click with the left mouse button:
sendmouse left dblclick
Press the left mouse button, move the mouse cursor 20 pixels left and 30 pixels down, and then release the button:
sendmouse left down
sendmouse move -30 20
sendmouse left up
Scroll the mouse wheel 10 units in standard wheel mouse. (On standard wheel mouse, the wheel value should be a multiple of 120).
sendmouse wheel 1200


这里结合vbs来调用nircmd举例:

鼠标定位:

Set sh = CreateObject("WScript.Shell")
sh.run("nircmd setcursor x y", 0, true);


按下鼠标左键:

Set sh = CreateObject("WScript.Shell")
sh.run("nircmd sendmouse left down", 0, true);



鼠标拖拽:注意鼠标拖拽要结合鼠标定位,按下鼠标左键,执行鼠标拖拽,抬起鼠标这一系列操作;

Set sh = CreateObject("WScript.Shell")
sh.run("nircmd sendmouse move moveX moveY", 0, true);


抬起鼠标左键:

Set sh = CreateObject("WScript.Shell")
sh.run("nircmd sendmouse left up", 0, true);


向下滚动鼠标滚轮:

Set sh = CreateObject("WScript.Shell")
sh.run("nircmd sendmouse wheel -1000", 0, true);


更多命令,请查阅nircmd命令参考
http://nircmd.nirsoft.net/
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值