Search notes:

goWnd.ps1

goWnd.ps is a PowerShell script that takes as its only argument the name of a process and then calls the WinAPI function SetForegroundWindow() with the process's main window handle.
#
#  Inspired by https://stackoverflow.com/a/12802050/180275
#

set-strictMode -version latest

if ( $args.count -lt 1 ) {
   write-host 'goWnd procName'
   return
}

$procName = $args[0]

$procs =  (get-process $procName)

if ($procs -eq $null) {
   write-host 'no processes found'
   return
}


add-type @"

  using System;
  using System.Runtime.InteropServices;

  public class user32_SetForegroundWindow {

     [DllImport("user32.dll")]
     [return: MarshalAs(UnmanagedType.Bool)]
      public static extern bool SetForegroundWindow(IntPtr hWnd);

  }
"@


$hWnd = $procs[0].MainWindowHandle
[user32_SetForegroundWindow]::SetForegroundWindow($hWnd)
Github repository scripts-and-utilities, path: /goWnd.ps1

See also

Examples for Visual Basic for Application accessing the Windows API: Bring window to the top
The get-process command let.
The method AppActivate in the .NET class Microsoft.VisualBasic.Interaction and the equally named VBA statement.
Scripts

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759390567, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/tools/scripts/personal/goWnd_ps1(87): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78