Subject: Re: How do I start two commands in .bat ?
From: "Karl M" <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 15 Jan 2003 07:00:58 -0800

Hi Igor...

You can not run the commands from the windows shell...you need to run them 
from a Cygwin sh or bash shell...otherwise the "detach after authentication" 
will not work.

If you have the commands as typed in v.bat then execute the file with the 
following command typed in a windows command shell

C:\Cygwin\bin\sh.exe "C:\...path to file...\v.bat"

You can also use the above line in the target field of a shortcut to get 
double clicking to work for you.

Hope this helps,

...Karl

>From: a12 <[email-masked]>
>To: Karl M <[email-masked]>
>Subject: Re: How do I start two commands in .bat ?
>Date: Wed, 15 Jan 2003 15:38:45 +0100
>
>Karl,
>
>I have put:
>
>ssh -f -L 5901:derqjzp:5900 -C isoft@derqjzp sleep 10
>/cygdrive/c/progra~1/realvnc/vncviewer.exe localhost:1
>
>into v.bat, and then double-clicked on it. v.bat executes ssh,
>requests isoft's password, and then sleeps for 10 secs.
>Eventually it closes the window, not executing vncviewer.
>
>What did you do to make your .bat file to execute vncviewer ?
>
>
>Karl M wrote:
>
> > Hi Igor...
> >
> > I usually do the following (for Windows 2000/xp):
> >
> > ssh -f -L 5907:LocalHost:5900 Coyote.Paguay sleep 30
> >
> > /c/Program\ Files/RealVNC/VNCViewer.exe -fullscreen -noauto LocalHost:7
> >
> > I put above two lines in a file and then launch an "sh" shell from a
> > shortcut with this file as a command line argument.
> >
> > The effect is to start ssh, prompt for a password and then detach and 
>let
> > vncviewer start. Then vncviewer starts and prompts for a password. When 
>I
> > exit vncviewer, the ssh tunnel closes automatically.
> >
> > Hope this helps.
> >
> > ...Karl
> >
> > >From: a12 <[email-masked]>
> > >To: [email-masked]
> > >Subject: Re: How do I start two commands in .bat ?
> > >Date: Tue, 14 Jan 2003 21:22:28 +0100
> > >
> > >Igor,
> > >
> > >My deepest apology for not following the rules of this list.
> > >I just say: mea culpa, mea maxima culpa.
> > >
> > >Yes, I have followed your suggestions in your earlier reply:
> > >
> > >rem @echo off
> > >start "VNC" /D"C:\Program Files\RealVNC" /B vncviewer.exe
> > >C:
> > >chdir C:\cygwin\bin
> > >bash --login -i -c "ssh -L 5901:derqjzp:5900 -C isoft@derqjzp
> > >vncviewer.exe"
> > >
> > >does start vncviewer.exe and shh. The only problem left is,
> > >that the ssh window is in background, and vncviewer window is
> > >in foreground, so I have move the ssh window to the foreground.
> > >Then I enter the isoft's password, switch to the vncviewer
> > >window, and establish vnc to derqjzp.
> > >Is it possible to make the ssh window to the foreground ?
> > >
> > >Your second suggestion:
> > >
> > >@echo off
> > >chdir C:\cygwin\bin
> > >bash --login -i -c "(/cygdrive/c/program\ files/realvnc/vncviewer.exe" 
>&);
> > >ssh -L 5901:derqjzp:5900 -C
> > >isoft@derqjzp"
> > >
> > >starts the vncviewer only. The ssh window does not appear at
> > >all. When I connect to localhost:1, I get the following error:
> > >Failed to connect to server.
> > >
> > >bash --login -i -c "ssh -L 5901:derqjzp:5900 -C -N isoft@derqjzp ;
> > >(/cygdrive/c/progra~1/realvnc/vncviewer.exe" &)"
> > >
> > >yields the same error.
> > >
> > >Any more hints ?
> > >
> > >
> > >Igor Pechtchanski wrote:
> > >
> > > > Did you follow up on the original "hint" ("help start")?  If you 
>did,
> > >you
> > > > would have come up with:
> > > >
> > > >         @echo off
> > > >         chdir C:\cygwin\bin
> > > >         start "C:\Program Files\realvnc\vncviewer.exe"
> > > >         bash --login -i -c "ssh -L 5901:derqjzp:5900 -C 
>isoft@derqjzp"
> > > >
> > > > As for backgrounding the program in bash, you should do it *before* 
>you
> > > > start ssh:
> > > >
> > > >         @echo off
> > > >         chdir C:\cygwin\bin
> > > >         bash --login -i -c "(/cygdrive/c/program\
> > >files/realvnc/vncviewer.exe" &); ssh -L 5901:derqjzp:5900 -C 
>isoft@derqjzp"
> > > >
> > > > Either of the above should work.
> > > >
> > > > For the future: the cygwin at cygwin dot com is really the only 
>cygwin
> > > > list even remotely appropriate for this kind of query.  Also, if you
> > >start
> > > > a thread on a mailing list, it's usually a good idea to continue 
>that
> > > > thread to its logical conclusion, as well as make sure the final
> > >solution
> > > > is in the list archives (it will be in this case).
> > > >         Igor
> > > >
> > > > On Tue, 14 Jan 2003, a12 wrote:
> > > >
> > > > > Daniel,
> > > > >
> > > > > vnc server is run on derqjzp
> > > > >
> > > > > C:
> > > > > chdir C:\cygwin\bin
> > > > > bash --login -i -c "ssh -L 5901:derqjzp:5900 -C isoft@derqjzp
> > > > > /cygdrive/c/progra~1/realvnc/vncviewer.exe"
> > > > >
> > > > > requests isoft's password, and start ssh
> > > > >
> > > > > C:
> > > > > chdir C:\cygwin\bin
> > > > > bash --login -i -c "ssh -L 5901:derqjzp:5900 -C isoft@derqjzp ;
> > > > > /cygdrive/c/progra~1/realvnc/vncviewer.exe"
> > > > >
> > > > > requests isoft's password, and shuts down the cygwin window.
> > > > >
> > > > > Any more hints ?
> > > > >
> > > > > Daniel Bößwetter wrote:
> > > > >
> > > > > > Which machine is vnc supposed to run on? localhost or derqjzp?
> > > > > >
> > > > > > In the former case, you's say
> > > > > >
> > > > > > bash -c "ssh isoft@derqjzp ; vncviewer"
> > > > > >
> > > > > > in the latter case
> > > > > >
> > > > > > bash -c "ssh isoft@derqjzp vncviewer"
> > > > > >
> > > > > > What you wrote (below) looks like you tried to start vncviewer 
>from
> > >the
> > > > > > .bat-file. This line is never reached, because bash never 
>returns
> > > > > > (unless you terminate ssh and even then it wouldn'r work, 
>because
> > >it's a
> > > > > > cygwin virtual path).
> > > > > >
> > > > > > Hope it helps.
> > > > > > Daniel
> > > > > >
> > > > > > a12 wrote:
> > > > > >
> > > > > > >Hello gurus,
> > > > > > >
> > > > > > >In my ongoing process of starting ssh and vncviewer in one .bat
> > > > > > >file, I have created the following:
> > > > > > >
> > > > > > >rem @echo off
> > > > > > >chdir C:\cygwin\bin
> > > > > > >bash --login -i -c "ssh -L 5901:derqjzp:5900 -C isoft@derqjzp"
> > > > > > >"/cygdrive/c/program files/realvnc/vncviewer.exe" &
> > > > > > >
> > > > > > >I enter the isoft's password, and ssh is started.
> > > > > > >vncviewer is not started.
> > > > > > >How do I make vncviewer started ?
> > > >
> > > > --
> > > >                                 http://cs.nyu.edu/~pechtcha/
> > > >       |\      _,,,---,,_                [email-masked]
> > > > ZZZzz /,`.-'`'    -.  ;-;;,_            [email-masked]
> > > >      |,4-  ) )-,_. ,\ (  `'-'           Igor Pechtchanski
> > > >     '---''(_/--'  `-'\_) fL     a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
> > > >
> > > > Oh, boy, virtual memory! Now I'm gonna make myself a really *big*
> > >RAMdisk!
> > > >   -- /usr/games/fortune
> > >
> > >
> > >--
> > >Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> > >Bug reporting:         http://cygwin.com/bugs.html
> > >Documentation:         http://cygwin.com/docs.html
> > >FAQ:                   http://cygwin.com/faq/
> >
> > _________________________________________________________________
> > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail

_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/