源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

VBS实现DOC转为文本文档的代码

  • 时间:2022-06-13 03:38 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:VBS实现DOC转为文本文档的代码
打开记事本输入: 
[u]复制代码[/u] 代码如下:
ON ERROR RESUME NEXT  set args=wscript.arguments  arg=args(0)  set w=createobject("word.application")  set fso=createobject("scripting.filesystemobject")  set docfile=fso.getfile(arg)  docpath=docfile.path  pt=left(docpath,Instrrev(docpath,"\"))  txtpn=pt&left(docfile.name,instrrev(docfile.name,"."))&"txt"  w.documents.open docpath,,,,,,,,,,,false  w.documents(docpath).activate  w.activedocument.saveas txtpn,2  w.activedocument.close  w.quit  set w=nothing 
保存到“C:\WINDOWS\doc2txt.vbe”。 记事本编辑 createobject("wscript.shell").regwrite "HKCU\docfile\Shell\\转为文本文档\Command\","wscript.exe C:\WINDOWS\doc2txt.vbe" 记事本编辑 createobject("wscript.shell").regwrite "HKCU\docfile\Shell\\转为文本文档\Command\","wscript.exe C:\WINDOWS\doc2txt.vbe %1" 以上内容保存为*.VBS,运行后,在doc文件上右击,就可以看到“转换为文本文档”项,点击就可以快速转换为文本文档。 以上内容在WIN2000加WORD2003下通过测试。 我在试验过程中发现,写入注测表的脚本运行后DOC右键有时并没有出现转换菜单,你可以将第二个脚本中的docfile改为*,就是在所有类型文件右键菜单添加转换项。 或者将doc2txt.vbe文件放到"sendto"文件夹,在doc文件上右击选“发送到~doc2txt.vbe”,同样可以转换。 此法同样可以将HTML,RTF等文件转换为文本文档。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部