use strict; if ($^O eq "MSWin32") { require Win32::AbsPath; # load Win32::AbsPath if under Windows } sub NormalizePath # normalize/fix the path { # if on a Windows platform my $path = shift; $path = Win32::AbsPath::Fix $path if $^O eq "MSWin32"; return $path; } my $command = NormalizePath('C:/Windows/System32/cmd.exe'); my $dir = `$command /C dir`; print "$dir";