用Nircmd轻松复制文件(文件夹)的完整路径

来源:互联网 发布:武汉微派网络 编辑:程序博客网 时间:2024/06/05 02:13

http://429006.com/article/technology/555.htm

pop:转载于鬼仔的blog,自己简单的编辑了一下,更加简洁和完整了。

     复制文件的完整路径通常情况先要复制文件的所在路径,还要复制文件的名称。然后将这两部分合在一起,非常的麻烦其实可以通过一款名字为“Nircmd”的软件来实现一键复制,它是个小巧但很强大的命令行工具,这样获取文件路径就会方便很多。

 先下载“Nircmd”(下载地址:http://www.onlinedown.net/soft/44565.htm),然后解压到X:\windows\system32目录下,接下来需要将下面代码保存为*.reg文件,然后双击导入即可。其内容如下:

“复制文件路径”注册表文件内容:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\copypath]
@="复制文件路径到剪贴板"

[HKEY_CLASSES_ROOT\*\shell\copypath\command]
@="nircmd.exe clipboard set \"%1\""

“复制文件夹路径”注册表文件内容:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Directory\shell\copypath]
@="复制文件夹路径到剪贴板"

[HKEY_CLASSES_ROOT\Directory\shell\copypath\command]
@="nircmd.exe clipboard set \"%l\""

  以后再获取文件完整路径的时候,在文件上按鼠标右键,就会看到多出一个“复制文件路径到剪贴板”选项(同样也适用于文件夹,在选择文件夹的时候就显示“复制文件夹路径到剪贴板”),选择这项之后就将文件完整路径进行复制,最后就可以粘贴所需要的地方。

pop补充:其实nircmd不仅仅只有这些功能,打开“NirCmd.chm”将会有更多的介绍。

Examples of what you can do with NirCmd:

Open the door of J: CD-ROM drivenircmd.exe cdrom open j: Close the door of Y: CD-ROM drivenircmd.exe cdrom close y:Increase the system volume by 2000 units (out of 65535)nircmd.exe changesysvolume 2000Decrease the system volume by 5000 units (out of 65535)nircmd.exe changesysvolume -5000Set the volume to the highest valuenircmd.exe setsysvolume 65535Mute the system volumenircmd.exe mutesysvolume 1Unmute the system volumenircmd.exe mutesysvolume 0Switch the system volume between the mute and normal state.nircmd.exe mutesysvolume 2Create a shortcut on your desktop that switch the system volume between the mute and normal state.nircmd.exe cmdshortcut "~$folder.desktop$" "Switch Volume" mutesysvolume 2Turn off the monitornircmd.exe monitor offStart the default screen savernircmd.exe screensaverPut your computer in 'standby' modenircmd.exe standbylog off the current usernircmd.exe exitwin logoffAsk if you want to reboot, and if you answer 'Yes', reboot the computer.nircmd.exe qboxcom "Do you want to reboot ?" "question" exitwin rebootTurn off your computernircmd.exe exitwin poweroffTurn off all computers specified in computers.txt !multiremote copy "c:\temp\computers.txt" exitwin poweroff forceDial to "My Internet" connectionnircmd.exe rasdial "My Internet"Disconnect the "My Internet" connectionnircmd.exe rashangup "My Internet"Make your Internet Explorer windows 75% transparent ! (192 / 256)nircmd.exe win trans ititle "internet explorer" 192Minimize all your Internet Explorer windowsnircmd.exe win min class "IEFrame"Close all your Internet Explorer windowsnircmd.exe win close class "IEFrame"Close all your Explorer windows (My Computer, folders, and so on)nircmd.exe win close class "CabinetWClass"Hide all your Internet Explorer windowsnircmd.exe win hide class "IEFrame"Show all your Internet Explorer windows (after you made them hidden with previous example)nircmd.exe win show class "IEFrame"Center all top-level windowsnircmd.exe win center alltopRemove the title bar of My Computer window.nircmd.exe win -style title "my computer" 0x00C00000Return the title bar of My Computer window that we removed in the previous example.nircmd.exe win +style title "my computer" 0x00C00000Set the My Computer window to right-to-left order (For hebrew and arabic languages)nircmd win +exstyle title "my computer" 0x00400000Set all child windows of My Computer window to right-to-left order (For hebrew and arabic languages)nircmd win child title "my computer" +exstyle all 0x00400000Create a shortcut on your desktop that closes all your Internet Explorer windowsnircmd.exe cmdshortcut " "~$folder.desktop$ "Close All IE" win close class "IEFrame"Create a shortcut on your desktop that hides all your Internet Explorer windowsnircmd.exe cmdshortcut " "~$folder.desktop$ "Hide All IE" win hide class "IEFrame"Create a shortcut on your desktop that shows back all your Internet Explorer windowsnircmd.exe cmdshortcut " "~$folder.desktop$ "Show All IE" win show class "IEFrame"Set the Windows Calculator as top-most window (above all other windows)nircmd.exe win settopmost title "Calculator" 1Set the Windows Calculator back to regular window (non top-most window)nircmd.exe win settopmost title "Calculator" 0Create a shortcut to Windows calculator under Start Menu->Programs->Calculatorsnircmd.exe shortcut "f:\winnt\system32\calc.exe" "~$folder.programs$\Calculators" "Windows Calculator"Hide the desktop windownircmd.exe win hide class progmanShow the desktop window (After hiding it in previous example)nircmd.exe win show class progmanHide the start button on the system traynircmd.exe win child class "Shell_TrayWnd" hide class "button"Show the start button on the system traynircmd.exe win child class "Shell_TrayWnd" show class "button"Hide the clock on the system traynircmd.exe win child class "Shell_TrayWnd" hide class "TrayClockWClass"Show the clock on the system traynircmd.exe win child class "Shell_TrayWnd" show class "TrayClockWClass"Kill (terminate) all instance of Internet Explorer processesnircmd.exe killprocess iexplore.exeCreate a shortcut on your desktop that opens the door of K: CDROM drive when you run it.nircmd.exe cmdshortcut "~$folder.desktop$" "Open CDROM" cdrom open k:Create a shortcut to NirSoft Web site on your desktopnircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.desktop$" "NirSoft"Add NirSoft Web site to your Favorities under Links folder.nircmd.exe urlshortcut "http://www.nirsoft.net" "~$folder.favorites$\Links" "NirSoft"Create a shortcut to NirSoft Web site on the desktop of all computers listed in computers.txtnircmd.exe multiremote copy "c:\temp\computers.txt" urlshortcut "http://www.nirsoft.net" "~$folder.common_desktop$" "NirSoft"Set the display mode to 800x600x24bit colorsnircmd.exe setdisplay 800 600 24Create a shortcut on the desktop that set the display mode to 800x600x24bit colorsnircmd.exe cmdshortcut "~$folder.desktop$" "800x600x24" setdisplay 800 600 24Copy all shortcuts on your desktop to another folder (f:\temp\desktop).nircmd.exe execmd copy "~$folder.desktop$\*.lnk" f:\temp\desktopRestart your Apache server (under Windows NT/2000/XP/2003)nircmd.exe service restart apacheCreate a shortcut on your desktop that restarts the Apache servernircmd.exe cmdshortcut "~$folder.desktop$" "Restart Apache" service restart apacheRestart your IISnircmd.exe service restart w3svcRestart MySqlnircmd.exe service restart MySqlOpen the desired Registry key/value in RegEditnircmd.exe regedit "HKLM\Software\Microsoft\Windows\CurrentVersion" "CommonFilesDir"Open the Registry key that you copied to the clipboard in RegEdit.nircmd regedit "~$clipboard$"Disable the screen savernircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 0Enable the screen savernircmd.exe regsetval sz "HKCU\control panel\desktop" "ScreenSaveActive" 1Change the date/time of the specified filename (creation time and modified time)nircmd.exe setfiletime "c:\temp\myfile.txt" "24-06-2003 17:57:11" "22-11-2005 10:21:56"Copy your desktop folder path to the clipboardnircmd.exe clipboard set ~$folder.desktop$Copy your start menu folder path to the clipboardnircmd.exe clipboard set ~$folder.start_menu$Copy the content of info1.txt (simple text file) to the clipboardnircmd.exe clipboard readfile "c:\My Files\info1.txt"Add the text content of clipboard to info1.txtnircmd.exe clipboard addfile "c:\My Files\info1.txt"Clear the clipboardnircmd.exe clipboard clearCreate all folders specified in "c:\temp\folders.txt". The folder path names are separated by CRLF characters.nircmd.exe paramsfile "c:\temp\folders.txt" "" "" execmd md ~$fparam.1$Install the specified .NET assembly in the global assembly cache (like gacutil)nircmd.exe gac install "C:\temp\MyAssembly\bin\MyAssembly.dll"Empty the recycle bin in all drives.nircmd.exe emptybinAnswer 'Yes' to a standard Windows message-box.nircmd.exe dlg "" "" click yes