Show quoted text> I cannot reproduce your issue on my Win7 box.
>
> Perhaps something specific to your Windows installation.
OK, I have only seen the issue on 64-bit Windows and only if some subdirectories to C:\Windows\System32 is involved, e.g. C:\Windows\System32\dns. Not all subdirectories produce the issue, which makes it difficult to understand and possibly hard to reproduce in other environments. I have however reproduced the issue on several different machines, I know that it isn't specific to one single installation.
I also modified the test a little, since the current working directory wasn't the only problem.
Example from 64-bit Windows 7, where I've manually created the dns subdirectory:
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; }
Exists
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; }
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\drivers\") { print \"Exists\n\"; }
Exists
Just to verify that there's no access problem to the directory, check with DOS command:
C:\>if exist c:\Windows\System32\dns ECHO YES
YES
Show quoted text> Maybe try:
>
> perl -e "system('cmd.exe /C if exist c:\temp echo YES')"
> or
> perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})"
These are the results, note the difference in working directory:
C:\Windows\System32\dns>perl -e "system('cmd.exe /C if exist c:\temp echo YES')"
C:\Windows\System32\dns>perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})"
C:\Windows\System32\dns>cd ..
C:\Windows\System32>perl -e "system(qw{cmd.exe /C if exist c:\temp echo YES})"
YES
I've done some further testing since I discovered the issue and I've found that:
- ActiveState Perl (32-bit) has the same issue.
- The 64-bit version of Strawberry Perl is not affected.
Example with 32-bit Strawberry Perl Portable:
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; }
Exists
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; }
C:\>c:\Bin\SBperl\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\database\") { print \"Exists\n\"; }
Example with 64-bit Strawberry Perl Portable:
C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\") { print \"Exists\n\"; }
Exists
C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\dns\") { print \"Exists\n\"; }
Exists
C:\>c:\Bin\SBperl64\Perl\bin\perl.exe -e "if (-e \"c:\\Windows\\System32\\database\") { print \"Exists\n\"; }
Exists
Cheers,
Daniel