Re: Emacs 24 with tramp on windows 7 can't find plink

Andy Moreton <[email protected]>
Newsgroups gmane.emacs.windows
Message-ID <[email protected]>
On Tue 11 Mar 2014, m silverstri wrote:

> I am running emacs 24 and I want to set up tramp to read/write file on
> my ubuntu machine.
>
> When I emacs 24 on windows 7 tryinng to open a remote file by C-x C-f
> /[email protected]:/home/mikes , tramp cannot find plink program. And
> i did print the exec path, I do have C:/Programs/Putty in my exec
> path:
>
> exec-path is a variable defined in `C source code'.
> Its value is
> ("C:/Programs/PuTTy" .....)
>
> But I still get
>
> plink -load 10.136.11.77 -t env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=#$
> ' /bin/sh && exit || exit
> plink is not recognized as an internal or external command, operable
> program or batch file.
>
> I have this in my .emacs:
>
> (require 'tramp)
>
> (require 'package)
> (add-to-list 'package-archives
>              '("melpa" . "http://melpa.milkbox.net/packages/") t)
>
>
> (add-to-list 'exec-path "C:/Programs/PuTTy")
> (if (eq system-type 'windows-nt)
>     (setq tramp-default-method "plinkx"))
>
> any idea how to fix my problem?

Does the executable exist as "C:\Programs\PUTTy\plink.exe" ? 

I have this on a Win7 64bit box, but it should work for 32bit too:

(when (eq system-type 'windows-nt)
  (let ((dir (expand-file-name "PuTTY" (or (getenv "ProgramFiles(x86)")
                                           (getenv "ProgramFiles")))))
    (add-to-list 'exec-path dir)
    (let ((case-fold-search t) (path (getenv "PATH")))
      (unless (string-match (regexp-quote dir) path)
        (setenv "PATH" (concat dir path-separator path))))))

(setq tramp-default-method "pscp")

A quick test shows that the "plink" method works for me, but "plinkx"
gives me problems - you will need to experiment. Setting tramp-verbose
can help with diagnosing problems.

HTH

    AndyM
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.