emacs 24 on windows 7, tramp cannot find plink pro

2020-07-18 11:03发布

问题:

I am trying to use Emacs 24.2 with Tramp on windows 7 to remotely edit files on a linux server. I installed the Putty suit program and OpenSSH. I also placed the plink.exe in the putty suit into the bin folder under the emacs 24 folder, and added the folder emacs24/bin into the PATH environment variable.

However, when I try to access the remote file from emacs with the command in the minibuffer: /username@host:filename, I get the following error message from emacs: plink is not recognized as an internal or external command. It seems that emacs cannot find the plink program. But, when I try to run plink in windows cmd, it can find the plink program. Also, I can ssh to the remote server in windows cmd.

Can anyone tell me what's my problem? Do I need to install cygwin to make it work? Thanks a lot.

回答1:

To get tramp with plink to work, I had to add my PuTTY path to my system search path.

On Windows 10: control panel >> System & Security >> System >> advanced system settings >> enviroment variables

To PATH I appended the PuTTY path: C:\Program Files (x86)\PuTTY

I'm guessing the key is that from PowerShell or the command prompt, you need to be able to run plink without specifying the path.



回答2:

I was able to resolve this and I did not have to install cygwin.

Try adding the path where putty was installed to your exec-path variable in emacs. Execute the following elisp code in emacs or put it in your .emacs file. Make sure the slashes are forward, not backslashes, as Emacs and Windows use different conventions.

(add-to-list 'exec-path "C:/Program Files (x86)/PuTTy")

check what exec-path is set to by typing C-h v exec-path