use Win32::API; use Win32::GUI qw { WM_CLOSE }; my $findwindow = new Win32::API("user32", "FindWindowA", ['P','P'], 'N'); my $hwnd = $findwindow->Call('Explorer', 0); Win32::GUI::SendMessage($hwnd, WM_CLOSE, 0, 0);