#perl use Win32::GuiTest qw(FindWindowLike MenuSelect WaitWindow WMSetText PushChildButton GetSystemMenu SetForegroundWindow); @windows = FindWindowLike(0, "Remote Desktop Connection"); for (@windows) #--for each of the open windows do the following { MenuSelect("&Close", 0, GetSystemMenu($_,FALSE)); }