#! C:\perl\bin\perl.exe my $file1 = "test1.txt"; my $cmd = "check.bat > C://$file1 2>&1"; system ( $cmd );