中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-08-08 22:58
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » doc转换为txt 查看 860 回复 0
楼 主 doc转换为txt 发表于 2008-06-03 19:19 ·  中国 广东 深圳 罗湖区 电信
初级用户
★★
积分 160
发帖 82
注册 2007-05-14 14:55
19年会员
UID 88494
性别 男
状态 离线
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 %1"
以上内容保存为*.VBS,运行后,在doc文件上右击,就可以看到“转换为文本文档”项,点击就可以快速转换为文本文档。
论坛跳转: