in reply to Perl in Windows - STDOUT to file Behavior difference by run context

I can't replicate your problem :) Maybe something jiggles loose from my tips

start+run "cmd" , then in the cmd.exe window

C:\Documents and Settings\username>dir /b fudge* File Not Found C:\Documents and Settings\username>echo echo fudge > fudge.bat

Then start+run "fudge.bat > fudge.txt"

Then back to cmd.exe window

C:\Documents and Settings\username>dir /b fudge* fudge.bat fudge.txt C:\Documents and Settings\username>type fudge* fudge.bat echo fudge fudge.txt C:\Documents and Settings\username>echo fudge fudge

So fudge.bat is called, fudge.txt is created, %userprofile% is the default cwd unless it was changed ( cruel microsoft tricks Re^4: cpan fails when MKS installed on Windows (HKCU\Software\Microsoft\Command Processor))

If I run "fudge2.bat > fudge2.txt" then fudge2.txt doesn't get created because fudge2.bat doesn't exist, but I also get a popup that windows can't find fudge2.bat

Why your perl program doesn't work? Impossible to say

For redirection, its best to do your testing from within cmd.exe ... and use absolute paths

Better yet, have perl redirect STDOUT/STDERR to files :

Some path/bat tips Re^4: OS independent perl script

some redirection ftype assoc tips ... probably doesn't apply if your stuff works from cmd.exe ... redirection problem, Win7, ASSOCiation , and @ARGV, Re: Out of date over <> and 5.10 (redir)

See also