2012-07-19 110 views
2

如何鏈接到來自組織模式的Windows環境中的網絡驅動器上的文件?鏈接到Windows網絡上的文件共享

我得到的錯誤:

eval: ShellExecute failed: The system cannot find the file specified.

與這種鏈接:

[[//share/path/to/file.csv]]

回答

2

我也有同樣的問題。我把它追溯到組織 - 開放式的點轉化的路徑,一些W32-殼 - 執行無法打開。用下面的defadvice,我能打開//和\網絡路徑。

(defadvice w32-shell-execute (around 
           workaround-for-org-w32-shell-execute 
           activate) 
    "Replace w32-shell-execute PATH directory seperators to Windows 
backslash when PATH starts with '//' (i.e. Network path). This 
allows allowing org-mode links in org-mode files like 
[[\\\\myserver\\mypath\\mydoc.doc][mydoc.doc]] to be opened by 
org-open-at-point. Forward slashes/are also accepted. 

org-open-at-point transforms the links to //../../ but 
unfortunately w32-shell-execute does not accept that." 
    (let ((operation (ad-get-arg 0)) 
     (path  (ad-get-arg 1))) 
    (when (and (string-equal operation "open") 
       (eql (string-match "//" path 0) 0)) 
     (setq path (replace-regexp-in-string "/" "\\\\" path)) 
     ;; debug (message "Opening %s" path) 
     (ad-set-arg 1 path)) 
    ad-do-it)) 

嘗試[//127.0.0.1/c$$]

這是一個快速和骯髒的修復,但「它的工作原理在我的機器」。

恪上的Emacs 24.2,ORG-模式7.9.11。

編輯:關於「不過,對我來說是很大的使用情況下打開其它類型的文件(如MS Office文件)的」註釋爲我工作,當我添加下面的協會組織模式。我可以打開Microsoft Word,Excel等,使用正常的組織模式的URL,例如[[\服務器\共享\ piyo.doc]

(mapc (lambda (file-name-matcher) 
    (add-to-list 'org-file-apps 
       (cons file-name-matcher 'default) 'append)) 
    (list "\\.doc\\'" 
     "\\.xls\\'" 
     "\\.ppt\\'")) 

編輯:關於「評論[文件+ SYS:] 「是」通過操作系統打開[文件],如雙擊「,這可以通過上述關聯來實現。在我的Windows電腦上,我不需要「[[file + sys:]]」。

+0

這非常適用於在股打開文本文件。非常感謝!但是,對我來說,一個很大的用例是用[[file + sys:]]超鏈接打開其他類型的文件(例如MS Office文件)。這些類型的鏈接仍然遇到同樣的問題。 – wdkrnls 2012-09-26 14:29:06

1

的Windows的某些部分,以及一些Windows應用程序,不支持UNC路徑。 Emacs的確如此,但它看起來像你(或組織模式)試圖執行某個程序,而不是簡單地使用find-file來查看Emacs中的文件。解決方法是將//share/path安裝爲X:並使用[[X:/to/file.csv]]作爲您的鏈接。

0

如果你的UNC路徑碰巧包括遠程磁盤驅動器(如\服務器\ C $或\服務器\ d $相關的管理共享的一個,你需要的磁盤代號後到$翻倍,讓他們看起來像\服務器\ C $$或\服務器\ d $$