Monday, December 15, 2025

How to move mouse position with powershell - Inverse for loop in Powershell

 for ($i = 100; $i -ge 10; $i--) {

   Start-Sleep -Milliseconds 1


   Write-Host "Iteration: $i"

 [System.Windows.Forms.Cursor]::Position =  "$i, $i "

}


or with 10 decrement

 for ($i = 1000; $i -ge 10; $i -= 10) {

   Start-Sleep -Milliseconds 1

   Write-Host "Iteration: $i"

 [System.Windows.Forms.Cursor]::Position =  "$i, $i "

}

No comments:

Post a Comment