我用如下代码能发现我所运行PowerShell脚本的控制台(title是TestControl)吗?
public static void WindowHide(string consoleTitle)
{
IntPtr a = FindWindow(“ConsoleWindowClass”, consoleTitle);
if (a != IntPtr.Zero)
///<summary>Hide Window</summary>
ShowWindow(a, 1);
else
throw new Exception(“Can’t hide console window”);
}