# This function takes the error number returned by the Win32::GetLastError function. #!/usr/bin/perl -w use Win32; $ApplicationName = 'c:\winnt\system32\notepad.exe'; $CommandLine = "notepad"; # Spawn the process. $status = Win32::Spawn( $ApplicationName,$CommandLine,$ProcessId ); if ( $status != 0 ) { print "Launched process with ID $ProcessId.\n"; } else { print "Failed to launch process.\n"; print Win32::FormatMessage( Win32::GetLastError() ); }