use warnings; use strict; open EXE, "cmd.exe" or die "Can not open cmd.exe:$! "; open EXEBACK, '>', 'c.exe' or die "Can not open c.exe:$! "; binmode(EXE); binmode(EXEBACK); while(<EXE>){ print EXEBACK $_; } close EXE; close EXEBACK;