VBS实现DOC转为文本文档的代码
2018-10-12 14:10
344 查看
打开记事本输入:
保存到“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等文件转换为文本文档。
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等文件转换为文本文档。
相关文章推荐
- Java平台要实现类似豆丁百度文科的文档在线阅读,总体思路是讲doc docx等文件格式利用jcom转换成pdf再用swftools转为swf。再用flexpaper组件显示swf。
- Java平台要实现类似豆丁百度文科的文档在线阅读,总体思路是讲doc docx等文件格式利用jcom转换成pdf再用swftools转为swf。再用flexpaper组件显示swf。
- 用vbs实现不死帐号的代码
- Spire.Doc 教程:将word文档中的隐藏文本保存到PDF
- 用C#编程实现在Excel文档中搜索文本
- C#代码实现PDF文档操作类
- 用vbs实现的exe2swf工具脚本代码
- C#代码实现上传文件到SharePoint文档库
- C#编程实现Excel文档中搜索文本内容的方法及思路
- 用VBS实现音乐播放的多个代码小结
- js实现双击单元格变成文本输入框效果代码
- 使用JSDoc建立JavaScript代码的文档
- 文本文档字处丽程序简单代码
- VB.net实现从ListView控件中异地获取文本内容源代码
- PHP生成静态HTML文档实现代码
- 用C#实现在Word文档中搜索文本
- C#编程实现在Excel文档中搜索文本