Random said:
Sorry here is the error message i am getting ...
'C:\Documents' is not recognized as an internal or external command,
operable program or batch file.
[quoting fixed - post new replies *below* the existing text. Thank
you]
Fix this the same way you would if you were running the command from
the command line, rather than from Perl: Enclose the name of the
command in single quotes:
system(" '$command' 1> C:\\JIMTEST.TXT 2>C:\\JIMTEST.TXT");
I don't think the single quotes will help on windows.
system(qq{"$command" 1 > C:\\JIMTEST.TXT 2 > C:\\JIMTEST.TXT});
Often times, the list form of the system call is overlooked:
perldoc -f system
... Note that argument processing varies depending on the number
of arguments. If there is more than one argument in LIST, or if
LIST is an array with more than one value, starts the program
given by the first element of the list with arguments given by
the rest of the list.
In this particular case, the OP needs the shell re-direction
functionality so I it would not help to call system with a list of
arguments, but when shell functionality is not needed, the list form
helps one avoid hassles with spaces in the path of the program being
invoked -- arguments to the program would still have to be quoted,
however.
Sinan