不会出现什么找不到dll的错误,没有dos窗口闪过。堪称完美级别。网上找到别人的不好用,要么还要安装个什么软件来设置。
于是自己动手吧,虽然只有简单几行代码,不过用了我6个小时的时间。
你的计算机里是没有elevate 和hideexec、后面的bat这些文件的,
下载所需的文件后放到c:\windows
如果你想放在其他目录,请修改对应的注册表路径。
elevate 和hideexec的下载 http://code.kliu.org/misc/
xp下的右键注册dll 的导入注册表的方法, 在win7下除非你禁用uac,要不没法用的。
下面我写的这个在win7 杠杠的。
注册dll.reg
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\dllfile\shell] [HKEY_CLASSES_ROOT\dllfile\shell\runas] @="注册DLL文件" [HKEY_CLASSES_ROOT\dllfile\shell\runas\command] @="regsvr32 \"%1\"" [HKEY_CLASSES_ROOT\dllfile\shell\uninstall] @="卸载DLL文件" [HKEY_CLASSES_ROOT\dllfile\shell\uninstall\command] @="hideexec elevate regsvr32 /u \"%1\""
不使用hideexec和elevate的方法:
把regsvr32 这个文件复制到 c盘根目录获取其他非系统文件夹,然后右键regsvr32属性,兼容设置中选中使用管理权限启动,之后在注册表中修改上述命令为
c:\regsvr32.exe %1 和c:\regsvr32.exe /u %1 如果你直接修改reg文件,注意 \ 字符转义。
右键 复制文件(夹)路径.reg
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\copypath] @="复制文件路径" "icon"="C:\\Windows\\system32\\SHELL32.dll,68" [HKEY_CLASSES_ROOT\*\shell\copypath\command] @="hideexec \"C:\\Windows\\copypath.bat\" \"%1\"" [HKEY_CLASSES_ROOT\Directory\shell\copypath] @="复制文件夹路径" "icon"="C:\\Windows\\system32\\SHELL32.dll,68" [HKEY_CLASSES_ROOT\Directory\shell\copypath\command] @="hideexec \"C:\\Windows\\copypath.bat\" \"%l\""
右键
复制文件(夹)名称.reg
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\copyname] "icon"="C:\\Windows\\system32\\SHELL32.dll,68" @="复制文件名" [HKEY_CLASSES_ROOT\*\shell\copyname\command] @="hideexec \"C:\\Windows\\copyfilename.bat\" \"%1\"" [HKEY_CLASSES_ROOT\Directory\shell\copyname] @="复制文件夹名" "icon"="C:\\Windows\\system32\\SHELL32.dll,68" [HKEY_CLASSES_ROOT\Directory\shell\copyname\command] @="hideexec \"C:\\Windows\\copydirectoryname.bat\" \"%1\""
---------------------------------------copydirectoryname.bat--------------------------------------------------------------
set/p"=%~nx1"<nul |clip
---------------------------------------copyfilename.bat
--------------------------------------------------------------
set/p"=%~n1"<nul |clip
---------------------------------------copypath.bat
--------------------------------------------------------------
cmd /u /c set/p"=%1"<nul |clip
保存所需的文件后放到c:\windows