Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to convert DOC to text document by VBS

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces VBS how to achieve DOC into text documents, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Open notepad and enter:

The code is as follows:

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

Save to "C:\ WINDOWS\ doc2txt.vbe".

Notepad editor

Createobject ("wscript.shell"). Regwrite "HKCU\ docfile\ Shell\\ convert to text document\ Command\", "wscript.exe C:\ WINDOWS\ doc2txt.vbe"

Notepad editor

Createobject ("wscript.shell") .regwrite "HKCU\ docfile\ Shell\\ convert to text document\ Command\", "wscript.exe C:\ WINDOWS\ doc2txt.vbe% 1"

Save the above content as * .VBS, after running, right-click on the doc file, you can see the "convert to text document" item, click to quickly convert to a text document.

The above content passed the test under WIN2000 plus WORD2003.

In the course of the experiment, I found that the DOC right button sometimes does not appear the conversion menu after the script written into the note table is run. You can change the docfile in the second script to *, which is to add conversion items to the right menu of all types of files.

Or put the doc2txt.vbe file into the "sendto" folder, right-click on the doc file and select "send to ~ doc2txt.vbe", which can also be converted.

This method can also convert files such as HTML,RTF into text documents.

Thank you for reading this article carefully. I hope the article "how to convert VBS into text documents" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report