Run the command in the new cygwin console

I want to do something similar to this with cmd in windows:

start dir c:\ 

The new console should open with the exit dir c :.
For Cygwin, I tried this:

 cmd /c start bash 'ls c:\\' 

The first part will open a new console, but I do not know how to output the result to a new console.

+4
source share
2 answers

You can use cygstart to run the program in a new console. Or run it in one of the other Cygwin terminals: mintty, rxvt (-unicode), xterm.

+4
source

cygstart is good, but not really intended for what is being given. You can think of cygstart <filename> as what happens if you double-click something in Windows Explorer, which means that it can open files in the program by default, as well as run executable files. However, both cygstart ... and cmd /c start ... will lose a nice terminal environment, so I recommend using something that launches a new terminal window, like run mintty .

For instance:

 man () { run mintty --title="man $*" bash --norc -c "command man $@ " } 

will open man pages in new windows so you can view them while still working in the current window.

+2
source

Source: https://habr.com/ru/post/1346134/


All Articles