3

M-x cmd runs the cmd, but upon typing ... well, anything ... I get "no answer".
How can I get plain old cmd in a separate emacs buffer? Like the one I would get by typing Win-R cmd?

p.s. Emacs newbie here ... just playing with it for a bit ... go easy on the flames ...

4
  • (That's the correct behavior because cmd.exe is only the command interpreter (i.e. like bash) and conhost.exe is the thing that actually draws the window (i.e. like xterm). To get a new window, use start.exe.)
    – billc.cn
    Jan 7, 2012 at 22:16
  • @billc.cn - I don't really care about the "correct" behaviour, more about the one I want. Is there a way then to get cmd in emacsw32?
    – Rook
    Jan 7, 2012 at 22:31
  • I don't use emacs, but if you run start, it should open cmd.exe in a new window by default.
    – billc.cn
    Jan 7, 2012 at 22:38
  • @billc.cn - Okey, yes, but what good is that? I mean, I know how to get a new cmd window, but I want it inside emacs, not as a separate window.
    – Rook
    Jan 7, 2012 at 23:43

2 Answers 2

1

Try M-x shell. A shell within emacs is even better than a command prompt.

3
  • I found "shell", but I need cmd. Some of my stuff depends on cmd behaviour.
    – Rook
    Jan 7, 2012 at 20:50
  • There is also M-x term, though I haven't used it myself, so I don't know if it works on Windows.
    – Tom
    Jan 8, 2012 at 8:05
  • No, I don't seem to have it (asks for an exe to run).
    – Rook
    Jan 8, 2012 at 12:24
0

I have defined the following function, which I have put in file "utilities.el".

(defun command-shell ()
  "opens a shell which can run programs as if run from cmd.exe from Windows"
  (interactive)
  (let ((explicit-shell-file-name "cmdproxy")
    (shell-file-name "cmdproxy") (comint-dynamic-complete t))
    (shell)))

In my initialization file I have

(autoload 'command-shell (concat my-lisp-area "utilities.el") "sets up a shell buffer for DOS commands" t)

This combination defines a command "command-shell", which initiates a shell buffer in which the shell is "cmd" from MS Window.

In my case cmdproxy.exe is found in "C:\Program Files\emacs-23.3\bin".

My Emacs version is "GNU Emacs 23.3.1 (i386-mingw-nt5.1.2600) of 2011-03-10 on 3249CTO".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .