With proper formatting (<c>...</c> tags for code, <p>...</p> for other paragraphs), your post would have looked like this:
Hi all,
I'm not able to collect the data
$data="install app device_path"'
$Result=`$data`;
The success output is
c:\Automation>install app device_path
<blank>
c:\Automation>
Failure output is
c:\Automation>install app device_path
<blank>
Error: Code 254587
<blank>
c:\Automation>
I also tried with STDERR redirecting even that did not work
$Result = `$Data 2>&1`;
Please help me on this thanks in advance
Also, instead of saying "I'm not able to", or "it doesn't work" etc.,
it's better to describe what exactly is happening, for example that the script does not run because it's producing an error message (if so, which?), or that the install command does not run, or that it does run, but its output goes to the console, etc.
In case the script doesn't run, that could be because your code as shown does not compile (note the superfluous trailing single quote/missing semicolon). Also, $data and $Data are two different variables in Perl.
| [reply] [d/l] [select] |
It is possible that it cannot run the install program. The reason might be that it cannot find the program file, or you do not have permissions, or something else. Rather than trying to guess the reason though, it would be better to test the exit code in $? after the `back-ticks` command.
Since you are running on Windows, make sure you are running this from CMD.EXE, not by double-clicking from Windows Explorer. Sometimes an error message is written directly to the console by the Windows shell, by-passing STDOUT and STDERR, for example 'install' is not recognized as an internal or external command,
operable program or batch file.
and that might be missed. | [reply] [d/l] [select] |
Thanks for the reply Dark.
| [reply] |