sdyates has asked for the
wisdom of the Perl Monks concerning the following question:

Thanks to everyone who has provided direction to me as I embark on using Win32::Process. Migrating from system() to Win32::Process has been anything but easy. However, I have overcome one major obsticle, to encounter another.

When I launch a new process, I want to be able to take the contents of the ourput and direct it to my $dump file. However, i cannot figure out how to redirect this output. I do not want to redirect all cmd output, just what the command 'identify' generates.

I have seen many documents throughout the web, yet none have provided me the right way to go. Even the man ages left me scratching my head. Once again, I have included the code in case you may have questions on my code.

I think Win32::Process::Create creates a new process directly from the program you send it. It does not start a shell and then have the shell start the process. Redirecting is a function of the shell. You may have to start "cmd" or "command" (depending on your shell) and have it start identify.exe in your Win32::Process::Create call.

Eitherway, I should be able to redirect the contents of the command from the screen to a file on disk. If I can do this using system, I am sure I can do it with Win32::Process, just cannot figure out how to do it. I cannot believe that Win32::Process would be lacking in that area. I am more convinces in my own ignorance that Win32's ignorance.

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)

Update: Note: the name of your shell is probably available in $ENV{COMSPEC}

Went to join the gridlock to see it
Held an eclipse party
Watched a live feed
I cn"t see tge kwubosd to amswr thus
I tried to see it, but 8000 miles of rock got in the way
What eclipse?
Wanted to see it, but they wouldn't reschedule it
Read the book instead