Hello Monks,
This is my first post.
I am trying to get the output of an executable in a file. This worked fine with Win2003 but on win2008 server due to compatibility issues, I changed the settings to win2003 SP1 for the executable to run. Honestly I am working on 2008 for the first time.
I see that the out put is getting forked in a new cmd prompt and exits after execution.Is there a way I can get the o/p from this forked window?
Error from the below program in my output file is "child exited with value 0".I am opeing a Dir, running tool.exe for each of the file in side it and spooling output to my file.
Thanks
Xhings
@files = readdir DH;
open STDOUT, '> '.$Location2.'\ProcessedFilesInDir.txt';
foreach $file (@files) {
$file1 = "tool.exe [- options]";
system ($file1) == 0 or die "system @args failed: $?";
if ($? == -1) {
print "failed to execute: $!\n";
}
elsif ($? & 127) {
printf "child died with signal %d, %s coredump\n", ($? & 127), ($
+? & 128) ? 'with' : 'without';
}
else {
printf "child exited with value %d\n", $? >> 8;
}
}
close STDOUT;
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|