简体   繁体   中英

Getting Window Position and Size in PowerShell

I am looking for a way to get the current size and position of a window by using PowerShell. I am currently using the UIAutomation ( https://uiautomation.codeplex.com/ ) package to do some other window manipulation so if anyone happens to know how to do it through PowerShell either with or without that package, I would be very interested to know.

Thanks!

Get-UIAWindow seems to have some additional properties that I didn't know were there. Using the BoundingRectange property, I was able to get all of the details about the window position, size, as well as the relative position.

The following will return a lot of data about the window for a Notepad.exe app:

$test = Start-Process notepad.exe -PassThru | Get-UiaWindow #| Get-UiaCurrentPattern -PassThru<br/>

$test.Current.BoundingRectangle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM