Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Executing a command using Net::SSH::Perl

by sugarboy (Beadle)
on Sep 23, 2010 at 12:28 UTC ( #861522=perlquestion: print w/replies, xml ) Need Help??

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

Hi All,

Am trying to executed the below command
net use Y: /DELETE
As there are some open files in it it asks for confirmation which is as follows:
There are open files and/or incomplete directory searches pending on the connection to Y:.

Is it OK to continue disconnecting and force them closed? (Y/N) N:

I would like delete irrespective of open files existing in it
Is it possible to provide execute the command providing interactive input as Y using Net::SSH::Perl

  • Comment on Executing a command using Net::SSH::Perl

Replies are listed 'Best First'.
Re: Executing a command using Net::SSH::Perl
by marto (Cardinal) on Sep 23, 2010 at 12:50 UTC

    Ssh? This is a windows command line utility, do you usually connect to a remote windows machine via ssh? If you read the documentation for net use you'll find the /y parameter is what you want.

Re: Executing a command using Net::SSH::Perl
by dorko (Prior) on Sep 23, 2010 at 14:30 UTC

    I would do what marto recommended.

    But the docs for Net::SSH::Perl say this should work:

    # Runs the command $cmd on the remote server and returns # the stdout, stderr, and exit status of that command. # If $stdin is provided, it's supplied to the remote # command $cmd on standard input. my ($out, $err, $exit) = $ssh->cmd($cmd, $stdin )



    -- Yeah, I'm a Delt.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://861522]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2020-11-25 03:07 GMT
Find Nodes?
    Voting Booth?

    No recent polls found