bogawk
bogawk

Reputation:

issue commands to window/process started from batch file

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?

Upvotes: 0

Views: 261

Answers (2)

edoloughlin
edoloughlin

Reputation: 5901

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/

Upvotes: 1

majkinetor
majkinetor

Reputation: 9036

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.

Upvotes: 0

Related Questions