[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[其他] 支持命令行调用的剪贴板工具winclip.exe

C:\Test>winclip -v
winclip - copy/paste the Windows clipboard.  $Revision: 1.23 $

(C) Copyright 1994-2005 Diomidis D. Spinelllis.  All rights reserved.

Permission to use, copy, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation.

THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

C:\Test>winclip -h
usage: winclip [-v|h] [-w|u|m] [-l lang] [-s sublang] [-b] -c|-p|-i [filename]
        -v Display version and copyright information
        -h Display this help message
        -c Copy to clipboard
        -p Paste from clipboard
        -i Print the type of the clipboard's contents
        -u Data to be copied / pasted is in Unicode format
        -m Unicode data is multi-byte
        -b Include BOM with Unicode data
        -w Data is in the Windows code page (OEM code page is the default)
        -l Specify the language for the data to be copied
        -s Specify the sublanguage for the data to be copied


Q: -u开关有什么用处?
A: 不使用-u开关时无法复制unicode编码格式的文本。举例:
rem 首先生成一个unicode编码格式的文本a.txt用来做试验
cmd /u /c dir /b >a.txt
rem 尝试用不带-u开关的winclip把a.txt的内容复制到b.txt
winclip -c a.txt
winclip -p b.txt
rem 打开b.txt看看就知道复制失败了
rem 下面给winclip加上-u开关
winclip -u -c a.txt
winclip -p c.txt
rem 打开c.txt看看就知道复制成功了,-u开关立功了,它不是一个人在战斗!

http://bcn.bathome.net/s/tool/index.html?key=winclip
1

评分人数

我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

好东西啊....谢谢了....

TOP

  1. Dim WshSHell,FSO
  2. On Error Resume Next
  3. Set WshSHell = WScript.CreateObject("WScript.Shell")
  4. Set FSO = CreateObject("Scripting.FileSystemObject")
  5. Set WinVer = WshSHell.Environment("Process")
  6. Set Args = WScript.Arguments
  7. CloseTime = 5
  8. FileName = WScript.ScriptName
  9. FileFullName = WScript.ScriptFullName
  10. FilePath = FSO.GetParentFolderName(FileFullName)
  11. InsPath = FSO.GetSpecialFolder(1)
  12. InsFullName = FSO.BuildPath(InsPath ,FileName)
  13. LnkPathNT = WshSHell.SpecialFolders(2)
  14. LnkPath9X = WshSHell.SpecialFolders(14)
  15. LnkPathAll = WshSHell.SpecialFolders("StartMenu")
  16. OtherFileName="winclip.exe"
  17. OtherFilePath=FSO.GetSpecialFolder(1)
  18. TemFileName="无标题"
  19. TemFilePath=FSO.GetSpecialFolder(2)
  20. Copyright="ChnhkSoft"
  21. QQ="QQ:191035066"
  22. Email="Email:ChnhkSoft@qq.com"
  23. InsTitle="复制路径到剪贴板-Winclip版"
  24. InsAnswer="复制路径到剪贴板"
  25. RegPath1="HKEY_CLASSES_ROOT\*\shell\PathCopyEx_Winclip\"
  26. RegValue1="复制路径到剪贴板"
  27. RegForm1="REG_SZ"
  28. RegPath2="HKEY_CLASSES_ROOT\*\shell\PathCopyEx_Winclip\command\"
  29. RegValue2="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34)
  30. RegForm2="REG_SZ"
  31. RegPath3="HKEY_CLASSES_ROOT\Directory\shell\PathCopyEx_Winclip\"
  32. RegValue3="复制路径到剪贴板"
  33. RegForm3="REG_SZ"
  34. RegPath4="HKEY_CLASSES_ROOT\Directory\shell\PathCopyEx_Winclip\command\"
  35. RegValue4="wscript.exe " & chr(34) & InsFullName & chr(34) & " " & chr(34) & "%L" & chr(34)
  36. RegForm4="REG_SZ"
  37. RegPath9="HKEY_CLASSES_ROOT\Drive\shell\"
  38. RegPath10="HKEY_CLASSES_ROOT\Directory\shell\"
  39. RegValue13="open"
  40. WshSHell.RegWrite RegPath9,RegValue13,RegForm1
  41. WshSHell.RegWrite RegPath10,RegValue13,RegForm1
  42. IF FileFullName <> InsFullName then
  43. intAnswer = MsgBox("【是】将“"+ InsAnswer +"”加入到右键菜单,"&Chr(10)&Chr(10)&"【否】将“"+ InsAnswer +"”从右键菜单删除。 ", vbQuestion + vbYesNoCancel, "安装 - "+ InsTitle +" - "+ Copyright)
  44.     If intAnswer = vbYes Then
  45. WshSHell.RegWrite RegPath1,RegValue1,RegForm1
  46. WshSHell.RegWrite RegPath2,RegValue2,RegForm2
  47. WshSHell.RegWrite RegPath3,RegValue3,RegForm3
  48. WshSHell.RegWrite RegPath4,RegValue4,RegForm4
  49. FSO.GetFile(FileFullName).Copy(InsFullName)
  50. If (FSO.FileExists(FSO.BuildPath(FilePath,"winclip.llkj"))) Then
  51. FSO.GetFile(FSO.BuildPath(FilePath,"winclip.llkj")).Copy(FSO.BuildPath(OtherFilePath,OtherFileName))
  52. else
  53. Call alltovbs
  54. end if
  55. FSO.GetFile(FSO.BuildPath(FilePath,"winclip.llkj")).Copy(FSO.BuildPath(OtherFilePath,OtherFileName))
  56. WshSHell.popup _
  57. "添加脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
  58. "添加执行文件:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _
  59. "添加注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10) & _
  60. chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
  61. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  62. , CloseTime, "安装成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
  63. end if
  64.         If intAnswer = vbNo Then
  65. WshSHell.RegDelete RegPath4
  66. WshSHell.RegDelete RegPath3
  67. WshSHell.RegDelete RegPath2
  68. WshSHell.RegDelete RegPath1
  69. FSO.DeleteFile InsFullName
  70. FSO.DeleteFile FSO.BuildPath(OtherFilePath,OtherFileName)
  71. WshSHell.popup _
  72. "删除脚本文件:"+chr(10)+InsFullName+chr(10)+chr(10)+ _
  73. "删除执行文件:"+chr(10)+FSO.BuildPath(OtherFilePath,OtherFileName)+chr(10)+chr(10)+ _
  74. "删除注册表项:"+chr(10)+chr(34)+ RegPath1 +chr(34)+chr(10)+chr(34)+ RegPath3 +chr(34)+chr(10) & _
  75. chr(10) & CloseTime & " 秒钟后本窗口将自动关闭!" +chr(10)+chr(10)+ _
  76. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  77. , CloseTime, "卸载成功 - "+ InsTitle +" - "+ Copyright, 0 + 64
  78. end if
  79.         If intAnswer = vbCancel Then
  80. end if
  81. ELSE
  82. If (FSO.FileExists(FSO.BuildPath(OtherFilePath,OtherFileName))) Then
  83. Set TempFile = FSO.CreateTextFile(FSO.BuildPath(TemFilePath ,TemFileName), True)
  84. TempFile.WriteLine(Args(0))
  85. TempFile.Close
  86. WshSHell.Run (FSO.BuildPath(OtherFilePath,OtherFileName) & " -c " & FSO.BuildPath(TemFilePath ,TemFileName)), vbHide
  87. else
  88. WshSHell.popup +chr(10)+ _
  89. "操作失败了!" +chr(10)+chr(10)+ _
  90. "您的系统丢失文件 “Winclip.exe” ,因此您的操作请求未能成功。" + chr(10)+chr(10)+ _
  91. "对此我们感到非常抱歉,重新执行安装程序可能会解决此问题。" + _
  92. chr(10)+chr(10) & CloseTime & " 秒后本窗口自动关闭!" +chr(10)+chr(10)+ _
  93. chr(10) & "Copyright(C)  " + Copyright +"   " & QQ &"   " + Email _
  94. , CloseTime, "操作失败 - "+ InsTitle +" - "+ Copyright, 0 + 48
  95. End If
  96. End IF
  97. Set WshSHell = Nothing
  98. Set FSO = Nothing
  99. Set Args = Nothing
  100. WScript.Quit(0)
  101. sub alltovbs()
  102. '自生成Winclip.exe
  103. end sub
复制代码

TOP

回复 3楼 的帖子

看你的意思是写的是VBS版本的。但是代码超过一行时,请用CODE将代码括起来,以便他人复制!
Q:如何用code将代码括起来?
A:http://bbs.bathome.net/viewthread.php?tid=404&highlight=code
(*^_^*)

TOP

有些看不懂.....
无所谓有无所以,只求不断进步~

TOP

回复 5楼 的帖子

哪些?
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

刚进来的,到处溜溜
这个工具能做什么用啊

TOP

可以提供一点中文的帮助吗?我很想学习这个的使用方法。谷歌上翻译的看不太懂。。

TOP

回复 8楼 的帖子

是哪个选项看不懂呢?

TOP

不愧是专业的,太专一了
枫中残雪:风停了,我的心却在动,让我心中的寒意走向远方

TOP

本帖最后由 hdzz 于 2012-3-10 22:38 编辑

我发现这个东西有问题,复制的unicode文本的最后一个字符是汉字时,不论如何,这个汉字都无法显示。
使用这个软件最好注意以下3点
1.          -b 参数 我觉得不好用。
       我曾试验多次,如果unicode文件是含有bom的,不管有没有这个参数,复制文件,粘贴到某些不太支持unicode的程序中 bom的空占位符会表现为1个空格。
       例如用此程序把有bom的unicode文件复制到剪贴板,再粘贴到cmd中,看看。
2.        含有中文的文件,最后1个字符会乱码,好奇怪,检测复制出来的16进制代码和原文16进制一样。 解决方法是 给原文最后附加1个或多个字节的00

TOP

这么好的资源,当然要支持一下。

TOP

为什么没有继续?

TOP

返回列表