A minimal commandline utility for interactively selecting a window from a script or batch file.
If you want to prompt the user to select a window and get a HWND to pass to another utility, you can do this:
selectwin.exe otherutil.exe /handle @@
It looks like this, the next click selects the hilighted window:
The otherutil.exe utility will be executed, and the @@ will be replaced with the handle number. If you just want to print the handle to stdout, you can do this:
selectwin.exe @@
A real example I use:
selectwin nircmd win settopmost handle @@ 1