xp下也能像vista那样快速复制某个文件的完整路径到剪贴板

来源:LZX’s Blog

以前在xp下的cmd可以将文件拖拽进来,但是在vista下, 我发现了一个很恶心的“new feature”,就是居然把这个功能去掉了。如果要获得一个文件的完整路径总是得手动通过“重命名”将文件名复制取出来,再拿到地址栏和那个路劲拼起 来, 如果是长文件名的话还要注意左右都加上个”符号,真的是相当的烦……

不过我相信微软不会这么无耻下贱的,于是google一番,发现到了很多人和我一样抱怨的帖子,也从那些帖子里才发现,原来居然有个隐藏指令,可以很方便的复制一个文件完整路径到剪贴板, 这样也算是弥补了不能拖拽文件到cmd的缺陷吧。

操作很简单: 就是 先按住SHIFT,然后鼠标右键一个文件的时候,菜单里面会多出个“复制为路径”。 这样就可以将这个文件的完整路径的text复制出来

===================无聊的分割线=====================

然后百度了下,原来介绍这个技巧的文章很泛滥。哎,惭愧。 如果你没发现你的右键菜单里面有多出个“复制为路径”,那么你的系统就是?我说的是VISTA~~~~~(难道你在XP下照着操作了^_!)

不过我觉得我很多时候用xp时, 也很需要这个特性, 于是在google上也发现了可以简单实现的方法。原文:http://www.winhelponline.com/blog/add-copy-as-path-option-to-the-context-menu-in-windows-xp/

第一,下载微软一个小程序:(不到6K)ftp://ftp.microsoft.com/Services/TechNet/samples/PS/Win98/Reskit/FILE/CLIP.EXE

第二,将下面的内容保存为copypath.vbs


'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'COPYRIGHT NOTICE: This script and all material at Winhelponline.com are registered
'with "The UK Copyright Service". No part of the Website can be distributed or ...
'republished without the author's written permission.
'Copyright ?2008 by Ramesh Srinivasan. All rights reserved.
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'CopyPath.vbs - File description
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'Copy the Path of a file or folder to the Clipboard
'Created on May 10, 2008
'Copyright ?2008 Ramesh Srinivasan.
'Author: Ramesh Srinivasan, Microsoft MVP (Windows Desktop Experience)
'Website: http://www.winhelponline.com
'"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
Set WshShell = WScript.CreateObject("WScript.Shell")
strMsg = "Completed!" & Chr(10) & Chr(10) & "CopyPath.vbs - ?2008 Ramesh Srinivasan" & Chr(10) & Chr(10) & "Visit us at http://www.winhelponline.com/blog"
strBaseBrch= "HKLM\Software\Classes\"
If WScript.Arguments.Count <> 0 Then
WshShell.run "%comspec% /c " & "echo " & chr(34) & _
WScript.Arguments.Item(0) & chr(34) & "| clip.exe",0
Else
rtn= Trim(UCase(InputBox ("Type INSTALL to add the COPY AS PATH context menu option, or type UNINSTALL if you wish to remove the context menu option from your system.", "Configuring CopyPath.vbs...", "INSTALL")))
If rtn = "INSTALL" Then RunInstall
If rtn = "UNINSTALL" Then RunUninstall
End if
Sub RunInstall
'Add registry values
On Error Resume Next
strCMD = "wscript.exe %systemroot%\copypath.vbs " & Chr(34) & "%1" & Chr(34)
WshShell.RegWrite strBaseBrch & "Allfilesystemobjects\shell\Copypath\", "Copy as Path", "REG_SZ"
WshShell.RegWrite strBaseBrch & "Allfilesystemobjects\shell\CopyPath\Extended", "", "REG_SZ"
WshShell.RegWrite strBaseBrch & "Allfilesystemobjects\shell\CopyPath\command\", strCMD, "REG_EXPAND_SZ"
On Error Goto 0
MsgBox strMsg, vbokonly,"Installed"
End Sub
Sub RunUninstall
'Remove the registry values added by this script.
On Error Resume Next
WshShell.RegDelete strBaseBrch & "Allfilesystemobjects\shell\CopyPath\command\"
WshShell.RegDelete strBaseBrch & "Allfilesystemobjects\shell\CopyPath\"
On Error Goto 0
MsgBox strMsg, vbokonly,"Uninstalled"
End Sub
'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
'This script was brought to you by "The Winhelponline Blog"
'Visit us at http://www.winhelponline.com/blog
'""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

第三, 上面两个文件,即copypath.vbs和CLIP.EXE都放到c:\windows目录下面,然后双击copypath.vbs,确定 之。

OK. 现在试试 按住shift后鼠标右键一个文件的时候,菜单里面是不是多出了个“复制为路径”了?

相关日志

楼被抢了 3 层了... 抢座Rss 2.0或者 Trackback

  • herozyf

    觉的还是用shellkit好点,功能多,还不繁琐,只需要注册一个dll
    不知道是不是我会错意了!

  • 有志小菜

    鬼哥,Blog怎么怎么回事啊!?又是国外的问题又是得罪了某人的。

    只想静下心来看会文章就这么难吗!?

  • 鬼仔

    @herozyf 这个也不错,SendTo+:http://huaidan.org/archives/636.html
    @有志小菜 没办法啊,我也不想这样,不过现在总算是又开了。

发表评论