Windows command script that moves mouse cursor N pixels?

batch-file, windows

Solution

The most straightforward way to manipulate mouse with batch file is with

rundll32 user32.dll,SetCursorPos

But this is not very useful - just sets the mouse to 0,0 position.

Check the mouse.bat - it is a self compiled C#/batch file and does not require external tools and the source is visible and editable.

Examples:

//clicks at the current position
call mouse click

//double clicks at the current position
call mouse doubleClick

//right clicks at the current position
call mouse rightClick

//returns the position of the cursor
call mouse position

//scrolls up the mouse wheel with 1500 units
call mouse scrollUp 150

//scrolls down with 100 postitions
call mouse scrollDown 100

 //relatively(from the current position) moves the mouse with 100 horizontal and 100 vertial postitions
call mouse moveBy 100x100

//absolute positioning
call mouse moveTo 100x100

//relative drag (lefclick and move)
call mouse dragBy 300x200

//absolute drag
call mouse dragTo 500x500

Problem

I am trying to find out how to move the mouse cursor N pixels to some direction.... through a command script, since I cannot install anything on my computer. I basically try to keep the screen active forever, until I kill the script. (Yes, I've been searching high and low for a way to do it by a command script.... but could not find anything. I hope it's possible.)

Original source

Related problems