2012-12-10 83 views
6

我想了解如何將鼠標光標N像素移動到某個方向......通過命令腳本,因爲我無法在我的電腦上安裝任何東西。移動鼠標光標的Windows命令腳本N像素?

我基本上試圖保持屏幕活躍,直到我殺死腳本。

(是的,我一直在尋找高和低的方式通過一個命令腳本來做到這一點....但找不到任何東西。我希望這是可能的。)

+12

我建議得到了一隻貓。把他放在你的桌子上。你會得到想要的效果。 – Shmiddty

+0

我懷疑在這種情況下是可能的。批處理腳本實際上沒有控制鼠標指針的先例。聽起來好像有一種更好的方式可以實現你想要達到的目標,無論如何。 – David

+0

@大衛:任何一個更好的方向? – rapt

回答

10

搜索的NirCmd ,並在安裝到C它:\ WINDOWS,並做到:點擊次數等

nircmd setcursor 100 50 
nircmd movecursor 10 10 

或其他命令

9

的最直接方式來操縱鼠標批處理文件是

rundll32 user32.dll,SetCursorPos 

但這不是很有用 - 只需將鼠標設置爲0,0位置。

檢查mouse.bat - 它是一個自編譯的C#/批處理文件,不需要外部工具,源文件可見且可編輯。

例子:

//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