in reply to Re: Re: Win32::Process redirect CMD output to text file
in thread Win32::Process redirect CMD output to text file
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: Win32::Process redirect CMD output to text file
by sdyates (Scribe) on Jun 25, 2002 at 17:32 UTC | |
|
Re^4: Win32::Process redirect CMD output to text file
by Anonymous Monk on Jan 06, 2006 at 09:38 UTC | |
by prayaspatel (Initiate) on Aug 28, 2012 at 20:30 UTC |