use strict; use warnings; use Data::Dumper::Concise; use Win32::Process; my $obj; while(1) { Win32::Process::Create($obj, "C:\\windows\\system32\\notepad.exe", "notepad", 0, NORMAL_PRIORITY_CLASS, ".") or die "Failed to start notepad"; $obj->Wait(INFINITE); print "Notepad exited - restarting\n"; }