I am trying to automate some processes with powershell/batch and want to wait for a window to pop up.
The window shows up in taskmgr but wont show via the tasklist command in the cmd, nor by get-process in powershell. Is there any way to do this?
Codes I've tried:
tasklist /v /fi "windowtitle eq Mapkey unterbrochen"
get-process
get-process xtop | format-list *
I want the window "Mapkey unterbrochen" to be found in a commmand. It shows up in taskmgr, so i guess it should be possible.
You can use FindWindow from Win32 API:
$extlib = @"
[DllImport("user32.dll", CharSet = CharSet.Unicode)]
public static extern IntPtr FindWindow(IntPtr sClassName, String sAppName);
"@
$win32 = Add-Type -Namespace Win32 -Name Funcs -MemberDefinition $extlib -PassThru
$wname = 'Mapkey unterbrochen' # any existing window name
$handle = $win32::FindWindow([IntPtr]::Zero, $wname )
if( $handle -gt 0 ) {
# windows found
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With