右键单击将文件复制到特定位置 [英] Copy file on right click, to a specefic location

查看:141
本文介绍了右键单击将文件复制到特定位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Windows 7的右键菜单中添加菜单项。
此菜单项将被称为复制到临时文件。

I would like to add a menu item to the right click menu in Windows 7. This menu item would be called something like "Copy to temp".

当点击该项目时,我想获取当前文件,在wihch我已经点击,并将其复制到一个特定的位置。

When clicking that item, I would like to take the current file, on wihch I've have clicked, and copy it to a specefic location. Overwriting it if it excists.

如下所示:

copy %selectedFile "c:\documents and settings\myuser\Desktop\destination_dir\"

任何人都有什么想法?

Anyone have any ideas?

感谢

/ Christoffer

/Christoffer

推荐答案

将以下内容合并到您的注册表中:

Merge the following into your registry:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Classes\*\shell\copyto]
@="Copy to Desktop"

[HKEY_CURRENT_USER\Software\Classes\*\shell\copyto\command]
@="cmd.exe /c copy /y \"%1\" \"C:\\Documents and Settings\\myuser\\Desktop\\destination_dir\\\""

它为所有用户工作,它变得有点复杂,因为您需要一个REG_EXPAND_SZ为命令子键的默认值:

If you want it to work for all users, it gets a little more complicated because you need a REG_EXPAND_SZ for the default value of the command subkey:

reg add "HKCR\*\shell\copyto" /v /t REG_SZ /d "Copy to Desktop" /f
reg add "HKCR\*\shell\copyto\command" /ve /t REG_EXPAND_SZ /d "%COMSPEC% /c copy /y \"%1\" \"%"USERPROFILE"%\\Desktop\\destination_dir\\\""

当然你也可以把命令并通过注册表项运行该脚本:

Of course you could also put the command in a batch script and run that script via the registry key:

@="C:\path\to\your.cmd \"%1\""

您还需要一个脚本处理自动创建缺少的目标文件夹。

You also need a script when you want to handle auto-creation of a missing destination folder.

无论何时, cmd 窗口选择新的上下文菜单条目。为避免您必须使用其他脚本语言,例如VBScript。

Either way a cmd window will be poping up briefly whenever you select the new context menu entry. To avoid that you'll have to use a different scripting language, e.g. VBScript.

这篇关于右键单击将文件复制到特定位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆