Link to home
Start Free TrialLog in
Avatar of dimmergeek
dimmergeekFlag for United States of America

asked on

Copy file contents from Notebad to WordPad

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?
Avatar of Frank Helk
Frank Helk
Flag of Germany image

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.
Avatar of dimmergeek

ASKER

I do not know VBS.
Can you help with the code?
ASKER CERTIFIED SOLUTION
Avatar of Ess Kay
Ess Kay
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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