tags:

views:

90

answers:

2

Hello Internets :)

I want to pass commands to a process started in a batch file, specifically Cygwin. For instance, if I start Cygwin with something like the following:

start "window1" cmd.exe /c cygwin

How might I execute 'ls' in "window1", in the same batch file from which I started Cygwin?

A: 

If you don't have cmd arg to cygwin to execute command in startup (like cmd.exe /K or /C) you can automate such thing with some script like AutoHotKey.

majkinetor
+1  A: 

I have to ask why you want to run the commands from a batch file? Do you want to take different actions based on the results/output of the commands?

In either case, what you are asking is bordering on impossible. Why don't you simply write your logic in a bash script and run

start "window1" cmd.exe /c c:\cygwin\bin\bash.exe -c [script]

where [script] is the path of your bash script.

Documentation on bash scripting is available at http://tldp.org/LDP/abs/html/

edoloughlin
It is indeed not possible, to my knowledge, to pass commands to another software. Your suggestion is good.
Jay