# single quotes here to keep the backslashes as-is my $tempfile = 'C:\Testing\TestNotepadRunning.txt'; # double quotes here to interpolate $tempfile system("TASKLIST > $tempfile");