use strict; use warnings; use File::Which; my $path = which('notepad.exe'); print $path; output: ------- C:\WINDOWS\system32\notepad.exe