Windows 中 Emacs 中的终端 - 错误消息:“生成子进程;无效参数”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4535432/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Terminal in Emacs in Windows - Error message: "Spawning child process; invalid argument"
提问by Amelio Vazquez-Reina
I'm trying to start a cmdterminal in Emacs 23.2 (latest version) in Windows.
我正在尝试在 Windows 的 Emacs 23.2(最新版本)中启动一个cmd终端。
According to the Manual, I can enter in terminal mode (starting a new buffer for the terminal) in Emacs by typing M-x term
.
根据手册,我可以在 Emacs 中输入终端模式(为终端启动一个新缓冲区)M-x term
。
When I do this, I get prompted for:
当我这样做时,我收到提示:
Run program: path_to-emacs/bin/cmdproxy.exe
When I type RET
, I get the following error message in the minibuffer:
当我输入 时RET
,我在迷你缓冲区中收到以下错误消息:
Spaning child process: invalid argument
Any ideas how to make it work?
任何想法如何使它工作?
Thanks,
谢谢,
采纳答案by Bleeding Fingers
The following should do:
以下应该做:
M-:
(make-comint-in-buffer "cmd" nil "cmd" nil)
M-xeshell
M-xshell
M-:
(make-comint-in-buffer "cmd" nil "cmd" nil)
M-x外壳
M-x贝壳
All have both their pros and cons. So choose what suits you best.
都有各自的优点和缺点。所以选择最适合你的。
回答by nispio
I got the same error while trying to run M-x compile
. I added the following to my .emacs
file and it fixed the problem:
我在尝试运行时遇到了同样的错误M-x compile
。我在我的.emacs
文件中添加了以下内容并解决了问题:
;; Make sure that the bash executable can be found
(setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/cygwin/bin")
Obviously this solution will only work if you have Cygwin installed, but if you are running Emacs on Windows it is usually worth at least a minimal install of Cygwin because many Emacs commands can leverage the command-line tools made available by cygwin (M-x compile
in my case).
显然,此解决方案仅在您安装了 Cygwin 时才有效,但如果您在 Windows 上运行 Emacs,通常至少值得安装 Cygwin,因为许多 Emacs 命令可以利用 cygwin 提供的命令行工具(M-x compile
在我的情况下) )。
回答by Benji L.
If you want to use term
or ansi-term
with cmd.exe or Cygwin bash on Windows with Win32 Emacs you can, take a look at this project:
如果你想在带有 Win32 Emacs 的 Windows 上使用term
或ansi-term
cmd.exe 或 Cygwin bash 你可以,看看这个项目:
Works very nicely for me on Win 10.
在 Win 10 上对我来说效果很好。
回答by Dave
Had the same problem.
有同样的问题。
I ran procmon and discovered that Emacs wants to find c:\bin\sh
in some form (sh.exe
, sh.bat
, sh.cmd
, etc).
Since I happened to want to use term mode with the android debugging shell, I created c:\bin\sh.bat
with contents "adb shell", and it worked fine, albeit with some weird input lag.
我跑procmon中,发现的Emacs想找到c:\bin\sh
某种形式(sh.exe
,sh.bat
,sh.cmd
等)。
由于我碰巧想在 android 调试 shell 中使用 term 模式,所以我创建c:\bin\sh.bat
了内容“adb shell”,它运行良好,尽管有一些奇怪的输入延迟。