in reply to Re: Net:::SSH::Perl to windows machine
in thread Net:::SSH::Perl to windows machine

Hi, As you suggested,
use Net::SSH::Perl; $sshobj = Net::SSH::Perl->new( $ARGV[0] ); $sshobj->login( "user", "password" ) or die "error $!\n"; for my $cmd ( '\"C:\\platform\\ilo\\bin\\lo100cfg.exe\\" -s 1>nul 2>&1', 'ls -l \"C:\\platform\\ilo\\bin\\lo100cfg.exe\\"', ) { print "----->$cmd<--\n"; my ( $out, $err, $ext ) = $sshobj->cmd($cmd); print "----->$out<--\n"; print "----->$err<--\n"; print "----->$ext<--\n"; }
Output:
----->\"C:\platform\ilo\bin\lo100cfg.exe\" -s 1>nul 2>&1<-- -----><-- ----->C:\platform\ilo\bin\lo100cfg.exe: not found<-- ----->0<-- ----->ls -l \"C:\platform\ilo\bin\lo100cfg.exe\"<-- ----->-rwxr-xr-x+ 1 ???????? None 172032 Jul 7 11:23 C:\platf +orm\ilo\bin\lo100cfg.exe<-- -----><-- ----->0<--

In the above result, ls -l is showing the exe file is exists. but when i was executing the same exe, its saying "exe not found" what could be the problem?

Thanks in Advance.

Replies are listed 'Best First'.
Re^3: Net:::SSH::Perl to windows machine
by Illuminatus (Curate) on Sep 17, 2009 at 12:45 UTC
    In order to provide complete help, it is necessary to know what sshd server is running on windows. Most importantly, what shell is being executed. When you type some-command 1>nul 2>&1 you should get nothing in either stdout or stderr, as you have redirected stdout to 'nul' and sent stderr there as well. The output 'some-command: not found' is a stderr msg, which you should not be receiving.
    1. Can you run the command with no arguments or redirections?
    2. It is clear that the 'ls' command works. Can you invoke it using a full path (including the drive letter)?
    3. If you are running ssh-2, can you execute the command using a relative path, ie
      $$sshobj->cmd("cd \"C:\platform\ilo\bin\""); $$ssh->obj->cmd(".\lo100cfg.exe");
      @Illuminatus, Thanks for your help. Finally it works..
      ($out,$err,$ext)= $sshobj->cmd('cd \"C:\\platform\\ilo\\bin\\"; ./lo10 +0cfg.exe -s');