Move to another window using PowerShell

SRIVASTAV, SOMYA 0 Reputation points
2024-08-23T13:11:24.28+00:00

Hello,

 

I have a requirement in PowerShell where I have to move from one window to another specific window, can I do it using PowerShell.

 

I am using below in my script to perform actions

 

I am using : "[System.Windows.Forms.SendKeys]" in a script. As an example : [System.Windows.Forms.SendKeys]::SendWait('F')

 

Can someone help me with this ? Thanks for the help in advance

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,447 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Rich Matheisen 46,551 Reputation points
    2024-08-23T15:12:25.3333333+00:00

    Read this thread: https://stackoverflow.com/questions/42566799/how-to-bring-focus-to-window-by-process-name

    Note that there are situations where it isn't possible to move the focus to another window. E.g. the target window is minimized.

    If more than one window has the same title you may also need to differentiate between them in some other way.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.