本帖最后由 aa77dd@163.com 于 2016-10-23 15:32 编辑
Win 7 系统下, 按住 Shift 键, 在文件/目录上右击的菜单中, 有一个
copy as path (中文系统: 复制为路径) 的功能, 此功能支持多个文件/目录对象, 无论路径中有无空格, 所有路径都会被加上双引号
path copy copy 是一个此功能的第三方工具, 有更大的扩展, 不用按住 Shift, 支持多文件/目录, 有许多选项可以自定义, 比如是否加双引号
如果不想安装 path copy copy 之类第三方工具, 也不需要同时复制多文件/目录的路径, 也不想要双引号,
cmd + clip 就能实现, 测试于 中文 Win 7 64 位
将下面批处理代码保存并运行, 安装选 S, 卸载选 D, 安装完成后, 批处理文件不需用到, 右键菜单出来后, 此功能的快捷键是 F
注册表中的功能实现命令是调用 cmd.exe 和 clip.exe 达成
- Windows Registry Editor Version 5.00 2> nul
- ; @echo off & cls & if "%~1"=="" (goto :choose) else goto :processPath
- [HKEY_CLASSES_ROOT\*\shell\CopyPathForSingleFile_Folder]
- @="copy path for single (&F)ile/Folder"
-
- [HKEY_CLASSES_ROOT\*\shell\CopyPathForSingleFile_Folder\command]
- @="cmd.exe /c <nul set /p \"=%V\"|clip"
-
- [HKEY_CLASSES_ROOT\Directory\Shell\CopyPathForSingleFile_Folder]
- @="copy path for single (&F)ile/Folder"
-
- [HKEY_CLASSES_ROOT\Directory\Shell\CopyPathForSingleFile_Folder\Command]
- @="cmd.exe /c <nul set /p \"=%V\"|clip"
-
- :processPath
-
- ;<nul set /p "=%*"|clip
-
- ;exit
-
-
- :choose
- ;echo;COPY PATH FOR SINGLE FILE/FOLDER
- ;echo; S SETUP
- ;echo; D DELETE
- ;<nul set /p "=Please choose:"
- ;call :GetKey
- ;echo;[%key%]
-
- ;if /i "%key%"=="s" goto :SetupMe
- ;if /i "%key%"=="d" goto :DeleteMe
- ;echo;choose error
- ;pause
- ;exit
-
-
- :SetupMe
- ;echo;Setup copy path for single file/folder ...
- ;regedit /s "%~f0"
- ;rem degug mode
- ;rem reg add "HKCR\*\shell\CopyPathForSingleFile_Folder\command" /ve /f /d "cmd.exe /k \"%~f0\" %%1"
- ;rem reg add "HKCR\*\shell\CopyPathForSingleFile_Folder\command" /ve /f /d "cmd.exe /c <nul set /p \"=%%V\"|clip"
- ;rem reg add "HKCR\Directory\Shell\CopyPathForSingleFile_Folder\command" /ve /f /d "cmd.exe /c <nul set /p \"=%%V\"|clip"
- ;echo;SETUP COMPLETE, PRESS ANY KEY TO EXIT...
- ;>nul pause
- ;exit
-
-
- :DeleteMe
- ;reg delete HKCR\*\shell\CopyPathForSingleFile_Folder /f
- ;reg delete HKCR\Directory\Shell\CopyPathForSingleFile_Folder /f
- ;echo;UNINSTALL COMPLETE, PRESS ANY KEY TO EXIT...
- ;>nul pause
- ;exit
-
-
- :GetKey
- ;set "key="
- ;for /F "usebackq delims=" %%L in (`xcopy /w . 2^>nul`) do (
- ; if not defined key set "key=%%L"
- ;)
- ;set "key=%key:~-1%"
- ;exit /b
复制代码 或者只用其中包含的注册表脚本也可以安装- Windows Registry Editor Version 5.00
-
- [HKEY_CLASSES_ROOT\*\shell\CopyPathForSingleFile_Folder]
- @="copy path for single (&F)ile/Folder"
-
- [HKEY_CLASSES_ROOT\*\shell\CopyPathForSingleFile_Folder\command]
- @="cmd.exe /c <nul set /p \"=%V\"|clip"
-
- [HKEY_CLASSES_ROOT\Directory\Shell\CopyPathForSingleFile_Folder]
- @="copy path for single (&F)ile/Folder"
-
- [HKEY_CLASSES_ROOT\Directory\Shell\CopyPathForSingleFile_Folder\Command]
- @="cmd.exe /c <nul set /p \"=%V\"|clip"
复制代码
|