in reply to Win32: Weird file copy failure using system

The COPY command is not a program in and of itself, but rather a built-in command implemented in CMD.EXE or other shell interpreter. There is no "COPY.EXE" file in MS-DOS or Windows. Therefore, the arg-list variety system(exe,args...) form of the command will not work. I don't know why some of your machines appear to succeed, and some fail outright.

Try system($ENV{ComSpec}, '/c', 'copy', $orig, $target) or something like it. Or, as you expected, you should check out the module, File::Copy for a more portable solution.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re^2: Win32: Weird file copy failure using system (no 'cmd /c')
by tye (Sage) on Jan 07, 2005 at 03:03 UTC

    No, you don't need to do this. In Win32 Perl, system(@list) is identical to system("@list"). Both detect commands that are internal to cmd.exe or command.com and do what you described automaticly.

    - tye