2012-07-19 59 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 $$

相关问题