1.

Solve : save RTF Files in plain Text file format?

Answer»

Hello All,

I am new to this forum.

I need a batch file which can save my *.rtf files in *.txt file.

I want to save Rich text Format to Plain Text Format using a batch file as there are 1000 of such rtf files.

Please help me.

Thanks in advance!

Welcome to the CH forums

And to do this just copy the code here to ur batch file and you can convert the files.

Code: [Select]cd C:\(Where ever the folder is)
copy *.rtf *.txt
echo Files Converted.
pauseThanks a lot for the quick reply.

Yes, I tried the told batch commands, and it does converts rtf to txt format, But the txt file contains some junk characters also all the lines are wrapped.

its not the format i want.

when i saved the rtf as text files by using the SAVE AS option. i am not getting any junk or wrapping problem.

Thanks!
Quote

cd C:\(Where ever the folder is)
copy *.rtf *.txt
echo Files Converted.
pause

Unfortunately it's not that simple. Changing the extension of a file does not change it's organization. If the OP has a copy of MS-Word, it is possible to write a simple VBScript to save the documents as text files.

Let us know. I do have VB for the above function, but i want to know is it possible to create a batch program to achieve what the VB is doing.

I think its possible through batch as batch files are easy to handle and work with.

Thanks!Sidewinder, you beat me to it.

Macdad, you goofed. Please check your answers before posting in future.

This is a text file containing just the words "This is a text file.":

Code: [Select]This is a text file.
This is an RTF file containing just the words "This is a rich text format file":

Code: [Select]{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang2057\deflangfe2057{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;}
{\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);}
{\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;
\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;
\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 \snext0 Normal;}{\*\cs10 \ADDITIVE \ssemihidden
Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid219276\rsid13575563
\rsid13646503}{\*\generator Microsoft Word 11.0.6568;}{\info{\title This is a rich text format file}{\author User}{\operator User}{\creatim\yr2008\mo5\dy7\hr22\min40}{\revtim\yr2008\mo5\dy7\hr22\min41}{\version1}{\edmins1}{\nofpages1}{\nofwords5}
{\nofchars29}{\*\company HOME}{\nofcharsws33}{\vern24579}}\paperw11906\paperh16838 \widowctrl\ftnbj\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace180\dghorigin1800\dgvorigin1440\dghshow1
\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftnlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\nojkernpunct\rsidroot13646503 \fet0\sectd \linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang
{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs24\lang2057\langfe2057\cgrid\langnp2057\langfenp2057 {\insrsid13646503 This is a rich text format file.}{\insrsid13575563
\par }{\insrsid13646503
\par }}Quote
I do have VB for the above function, but i want to know is it possible to create a batch program to achieve what the VB is doing.

Under the circumstances, the CLOSEST to a batch file would be the one to launch your VB converter program.

Is your VB program interactive or batch?

wait you guys, wat if he put in the Findstr command and did that for all the converted txt files so he COULD look for anything in the brackets and delete EM from the file.
except wat is the command for deleting specific lines in a file. edlin?Quote from: macdad- on May 08, 2008, 05:40:32 AM
wait you guys, wat if he put in the Findstr command and did that for all the converted txt files so he could look for anything in the brackets and delete em from the file.

Because {\insrsid13646503 This is a rich text format file.} is in brackets, it would GET deleted. Anyway, writing a VB script is, in my opinion, the easiest and most efficient way to achieve what the OP is trying to do.yea, i guess.


Discussion

No Comment Found