Board logo

标题: VBS读取文件内容到剪切板 [打印本页]

作者: batman    时间: 2009-4-25 22:42     标题: VBS读取文件内容到剪切板

  1. '本vbs是读取的当前目录下的a.txt的内容,请自行修改path值
  2. dim strcopy,path
  3. set wshshell=createobject("wscript.shell")
  4. path=wshshell.currentdirectory
  5. set objfso=createobject("scripting.filesystemobject")
  6. set objtxt=objfso.opentextfile(path&"\a.txt",1)
  7. strcopy=objtxt.readall
  8. set objie=createobject("internetexplorer.application")
  9. objie.navigate("about:blank")
  10. objie.document.parentwindow.clipboarddata.setdata "text", strcopy
  11. objie.quit
  12. set objie=nothing
  13. set objtxt=nothing
  14. set objfso=nothing
  15. set wshshell=nothing
复制代码

作者: defanive    时间: 2009-4-25 23:51

还是得通过IE啊。。。
vbs没有自带ClipBoard对象么。。。




欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2