Terminal in Emacs in Windows - Error message: “Spawning child process; invalid argument”

前端 未结 6 599
南笙
南笙 2021-02-01 14:31

I\'m trying to start a cmd terminal in Emacs 23.2 (latest version) in Windows.

According to the Manual, I can enter in terminal mode (starting a new bu

相关标签:
6条回答
  • 2021-02-01 14:47

    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:

    fakecygpty

    Works very nicely for me on Win 10.

    0 讨论(0)
  • 2021-02-01 14:49

    The following should do:

    • M-:(make-comint-in-buffer "cmd" nil "cmd" nil)

    • M-xeshell

    • M-xshell

    All have both their pros and cons. So choose what suits you best.

    0 讨论(0)
  • 2021-02-01 14:50

    Try M-x cmd-shellinstead. I suggest using EmacsW32 for the best results.

    0 讨论(0)
  • 2021-02-01 14:54

    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.

    0 讨论(0)
  • 2021-02-01 15:01

    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:

    ;; 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).

    0 讨论(0)
  • 2021-02-01 15:01

    I've been using this in my .bash_profile, you should be able to set this to whatever you need. Note - when I do this I need to re source ~/.bash_profile to get all of my aliases and stuff, which I still haven't figured out.

    When I run Emacs by "clicking" a file to start Emacs - I get a Windows CMD line, when I launch from within cygwin - I get a cygwin type shell.

    export ESHELL="c:/cygwin64/bin/bash.exe"
    
    0 讨论(0)
提交回复
热议问题