instead of echo foo put in the program you want to run. Win32::Process is doing what you ask of it - it is creating a process running "identify.exe". "indentify.exe" does not know how to redirect. You have to run "cmd.exe" and have it start "identify.exe" and redirect the output to a file. system transparently starts a shell (cmd.exe) and hands it the parameters, the first of which is the program it should run. Most people from a windows background don't understand that a command prompt is actually a program called "cmd.exe" (or "command.com" on dos/win9x)use Win32::Process; Win32::Process::Create($ProcessObj, 'c:\winnt\system32\cmd.exe', "/c echo foo>foo.txt", 0, NORMAL_PRIORITY_CLASS,".")||warn "could not create process";
Update:
Note: the name of your shell is probably available in $ENV{COMSPEC}
--
flounder
In reply to Re^3: Win32::Process redirect CMD output to text file
by flounder99
in thread Win32::Process redirect CMD output to text file
by sdyates
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |