I have a large amount of command-line utilities that I use in day-to-day development (eg Maven, ant, Grizzly, mplayer, CASE tools, etc). I use Windows. Every time I want to kick off a new process, I end up having to create a new cmd.exe process and type in what I want to run. Sometimes, I'll have five cmd.exe's open at a time!! It's getting hard to manage.

Is there some way to do this directly in emacs? Here's what I would like:

  • Have several cmd.exe's output be stored in emacs (probably a new buffer for each)
  • Ability to send stdin and ctrl-c to the process
  • Easy way to restart the command without retyping the whole thing (like pressing the up arrow in cmd.exe)
  • Ability to paste certain parameters to the command to run (eg -file=C:\my\directory\my.file)
  • Ability to copy output to the clipboard. Ideally not breaking at 40 columns or so like cmd.exe does.

This sounds like a workable task in emacs, but I can't quite figure out how to do it. I'd love to be able to use ssh and do something similar on remote Linux boxes as well.

Maybe there's another more obvious solution than emacs. If so, please enlighten me.

EDIT: I noticed emacs has a eshell command. I think my needs would be met if I could get this to work on several buffers at once.


I'm a linux/emacs biased person, so here's what I would try:

  • install cygwin with its version of emacs
  • run multiple shells within emacs. M-x shell launches a shell within emacs. If you give a prefix arg (C-u M-x shell), emacs will prompt you for the name to give to the shell buffer. This way you can have multiple shell buffers.
  • create bash aliases for the various tasks to run, for example create an alias called "mp" for something like "mplayer -option1 -option2 23"

Many people who aren't linux/cygwin inclined like PowerShell. This also provides aliases. Some people have written about running powershell inside emacs.

  • Can you expand on "run multiple shells within emacs"? That's the part I can't quite get to happen. A M-! gives a Shell Command Output buffer. Can I get several of these buffers?
    – User1
    Oct 27 '09 at 15:12
  • I've updated the second bullet point to expand on your question. Oct 27 '09 at 15:27
  • very nice! Bonus question: what's the best way to change the default path?
    – User1
    Oct 27 '09 at 16:03
  • cmd.exe runs fine. Cygwin is grumpy. I'll open a new question.
    – User1
    Oct 27 '09 at 19:16
  • A related question: superuser.com/questions/61605/…
    – User1
    Oct 27 '09 at 19:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.