?
Solved

Copy file contents from Notebad to WordPad

Posted on 2012-08-22
5
Medium Priority
?
617 Views
Last Modified: 2012-08-22
I have a text file that has some hidden characters which show up in WordPad, but not in notepad.
When I try to execute a script on my server with this file, it errors out because the line feeds aren't there.

How can I write a batch file which opens the text file and copies all contents, then writes those contents to a WordPad document?
0
Comment
Question by:dimmergeek
  • 3
5 Comments
 
LVL 14

Expert Comment

by:frankhelk
ID: 38320933
Sorry for not supplying sutch a batch file, but batch files are not the preferred way of doi'n that.

I would suggest some small piece of software (it's more or less simple to do in VB or C) for that.

Simple version:

Read the file in binary mode, say in chunks of about 100 Bytes into an array of char.
after reading each chunk, go sequentially over the chunk and write every byte to the output file that is printable (ASCII 32-127 & CR, LF, TAB)
repeat until file completed.

That way any unwanted characters will be stripped away.
0
 
LVL 7

Author Comment

by:dimmergeek
ID: 38320996
I do not know VBS.
Can you help with the code?
0
 
LVL 15

Accepted Solution

by:
Ess Kay earned 800 total points
ID: 38321083
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38321086
0
 
LVL 15

Expert Comment

by:Ess Kay
ID: 38321092
what do you mean by 'wordpad file'?

they both open txt files


Just open it with wordpad instead of notepad and hit save, so it will keep the wordpad formatting
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question