On 03/04/2009, Michael K. Craghead <[email protected]> wrote:
> It turned out to be relatively simple. All I had to do was create a command
> line with a string of the absolute path of cygwin (relative path probably
> works as well if cygwin is in your PATH or System Path):
>
> Executor exec = new DefaultExecutor();
> CommandLine cl = new CommandLine("c:\\cygwin\\cygwin.bat");
>
> The part that I was confused about was how to get the Executor to take the
> scp as part of the cygwin and not a windows command since the openssh package
> works as part of cygwin and not windows (if anyone knows how to use a cygwin
> ssh package directly from Windows please let me know). All I needed was a
> pipe ('|'). I didn't think it would be that simple, as it's been years since
> I've done any real work on *NIX without a GUI interface of some sort.
I think you can just run the Cygwin exes in a DOS window.
For example, I just tried:
d:\cygwin\bin\man.exe bash
and that showed the man page for bash.
The Putty toolkit has an ssh command-line client you can use from
Windows, called "plink". Also "pscp" for copying files.
> cl.addArgument("|");
> cl.addArgument("scp");
> cl.addArgument("-B");
> cl.addArgument(StringUtils.quoteArgument("/cygdrive/c/Documents and
> Settings/michael/some _file"));
> cl.addArgument("mich...@my_remote_host:/home/michael");
> exec.executive(cl);
>
> Of course I had to use the quoteArgument() method for the absolute path of
> the file to be transferred since it has spaces and *NIX doesn't like spaces.
> That was it. I think cygwin would stay 'active' as long as you kept adding
> pipes and *NIX commands/scripts to the command line. I haven't played with
> it. It's just a guess.
>
> For me, the hardest part was just getting openssh setup properly since I
> hadn't used it before.
>
> Thanks for your interest.
> Michael K. Craghead
>
>
>
>
> ________________________________
> From: Siegfried Goeschl <[email protected]>
> To: Commons Users List <[email protected]>
> Sent: Friday, April 3, 2009 4:38:52 PM
> Subject: Re: [commons-exec] How to exec scp from cygwin?
>
>
> Hi Michael,
>
> no idea since I never used cygwin but it would be highly appreciated if
> you share your insights ....
>
> Thanks in advance
>
> Siegfried Goeschl
>
> Michael K. Craghead wrote:
> > Looking at the tutorial for exec it doesn't look to difficult to use, but
> I'm not sure how to go about setting up an exec for an scp command that runs
> inside of cygwin. Can someone point me in the right direction? Thanks.
> > Michael K. Craghead
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]