IKA
IKA

Reputation: 161

Simulate mouse click on windows start up using scripts

I'm looking for to find a way to write a .bat to simulate mouse right click on desktop, right after log on. OS is Windows 8.1

Upvotes: 1

Views: 6360

Answers (1)

Samuel Nicholson
Samuel Nicholson

Reputation: 3629

Not possible within batch unless you create a batch file to then generate something like a VBS script and then run that VBS script, slight over kill though.

I'd use VBscript (.vbs) and add that to the startup folder to load when a user logs on to the machine.

Set WshShell = wscript.createobject("Wscript.Shell") 
WshShell.SendKeys("+{F10}")

Something as simple as the above .vbs script will perform a right click when ran. - Possibly the simplest way I can think of using a script.

Note: this right clicks where the mouse is pointing so perhaps a small wait command before the click might be needed, or even moving the windows pointer before the sendKeys command.

If you have multiple users then perhaps using a batch file would work well, you can store the vbs script on a network share that everyone can access and then you wouldn't have to modify the vbs for every user should you need to make changes.

See the below example.bat:

@echo off
start \\PATH\script.vbs
exit

Upvotes: 2

Related Questions