http://qs321.pair.com?node_id=861522

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
Thanks,

Sagar
  • 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
    Hello,

    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 )

    Cheers,

    Brent

    -- Yeah, I'm a Delt.