Batch/PowerShell script that toggles the minimized state of a window
It took a bit to wrap me head around what you have here. It certainly is a piece of work. Rather clever what you have done in order to have a file that runs batch and PowerShell. Bravo sir! It also seems you like doing this with other languages as well!
I will first try to address your questions first and then some other points I feel worth mentioning.

In practice there are of course better options until you put in the minimized exception. In my minimal practice of you code and the suggestions you tried I think, in general, your approach is required. This is the weakest part of the review as I do not have much to offer here.

Is there any situation where FindWindowEx() would not be able to find a window that could be found with FindWindow()? Refering to the documentation for FindWindow() I did find some evidence which could convince you to stick with FindWindowEx()

Retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. This function does not perform a case-sensitive search.



That might not change anything but depending on the target of the script it might not find the window you are looking for if you use FindWindow().

There is a few things to touch on. Most are just FYI. For the ones that are more than that I will try and draw a little more attention to them.
Invoke-Expression
The hybrid-ness of your script relies on this. I am sure that you do it so that it is self contained. However, in case no one mentioned it: Invoke-Expression can be evil. While I don't take that to heart it is potentially dangerous to use as someone can inject code into that file and it will execute blindly.
If you are willing to have a .ps1 file that gets called it would be safer. That is my tactful way of addressing &quot;Why not just write the whole thing in PowerShell?&quot;
Don't really expect you to adhere to the advice. Just wanted you to be aware.
Comments
This is a big one since you are giving this to someone else. This script is lacking of comments. While I do not code much in batch the PowerShell is lacking and some of the idiosyncrasies of this script were lost on me until I looked up the documentation. While you might know what is going on now you might not months/years from now.
For instance I had to look up to documentation for the line $hwnd = (ps $env:prog)[0].MainWindowHandle. Something simple like
# MainWindowHandle will return 0 if the process in hidden/minimized.

Again that could just be me but in general this is lacking context comments.
Get-Content
I see that you are reading the file in as one string using a -join. I would think that you have at least PowerShell v3.0. Either way there are cleaner options for reading the file in as one string.
# PowerShell v3.0+
&quot;iex (gc \&quot;%~f0\&quot; -Raw)&quot;
# PowerShell 2.0
&quot;iex (gc \&quot;%~f0\&quot; | Out-String)&quot;

Determining Title
Parsing cmd output is a specialty of mine. From the looks of it you are banking on Window Title being the last line of the output. While I doubt there will ever be a problem I can not say that nothing would go wrong with that logic.
With what little it would take to get more reliable results I would go so far as to change that.
$titles = tasklist /v /fi &quot;imagename eq Keepass*&quot; /fo list | 
        Where-Object{$_ -match &quot;^Window Title:\s+?(.*)&quot;} | 
        ForEach-Object{$Matches[1]}

Notice I also used $titles since you could have multiple matches. The way you had it before would just take the last one. Could do just the same with a Select -First 1

Again, I am impressed with the script you have set up here.