473,396 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CMD file processing creates a weird character...

140 100+
Hi,
I have a batch cmd file that calls a program three times, each time it generates a txt file.
Then I use (MS DOS) copy to append the three files together.

At the end of the newly created combination file, there is a mysterious character that looks like a short fat pipe "|" . The command file takes two arguments, an input file and an output file. The program meshUtil does certain things to the file depending on how many arguments are passed in. MeshUtil works correct. If I run JUST step three, it doesn't create the short fat pipe. Its definitely created by the copy command. Unsure if it matters, but the input file was saved as a UNIX file.

Expand|Select|Wrap|Line Numbers
  1. meshUtil %1 out1.txt
  2. meshUtil %1 Xmax 2 out2.txt box
  3. meshUtil %1 out3.k copy
  4. copy out1.txt+out2.txt+out3.k %2
  5. del out1.txt
  6. del out2.txt
  7. del out3.k
  8.  
Any help or suggestions would be much appreciated.

Thanks,
Sitko.
Dec 13 '07 #1
5 8273
sitko
140 100+
I guess no one has ever seen anything like this?
Dec 17 '07 #2
Not sure if you found a solution but for others that may stumble on this:

I can confirm that on XP SP2 my copy command leaves a strange character at the end of the newly created file when I use the append mode
Expand|Select|Wrap|Line Numbers
  1. copy file1+file2+file3 newfile
I found that if I made sure that all the source files were saved in a UTF-8 and I used the "/b" binary switch then it worked and I didn't have the strange characters.

Expand|Select|Wrap|Line Numbers
  1. copy /b file1+file2+file3 newfile
  2.  
Hope that helps somebody. I still wish I had a better explanation of what exactly is happening and an easier solution.
Feb 10 '08 #3
sitko
140 100+
Not sure if you found a solution but for others that may stumble on this:

I can confirm that on XP SP2 my copy command leaves a strange character at the end of the newly created file when I use the append mode
Expand|Select|Wrap|Line Numbers
  1. copy file1+file2+file3 newfile
I found that if I made sure that all the source files were saved in a UTF-8 and I used the "/b" binary switch then it worked and I didn't have the strange characters.

Expand|Select|Wrap|Line Numbers
  1. copy /b file1+file2+file3 newfile
  2.  
Hope that helps somebody. I still wish I had a better explanation of what exactly is happening and an easier solution.
I'll try it, but I do know that I need the files to be text instead of binary, but I'm sure thats just a binary copy, instead of making binaries...

:)
Feb 13 '08 #4
In Vista, COPY file1+file2 introduces the same weird characters into file1 when file1 or file2 contains carriage returns and linefeeds.

copy /b file1+file2+file3

worked for me. Thanks!
Aug 13 '12 #5
Same issue with Windows 7 Enterprise.
There was always a HEX 1A at the end.

copy /b file1+file2 targetfile
worked for me also, Thanks!
Nov 17 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: George | last post by:
Newbie question: I'm trying to lauch Notepad from Python to open a textfile: import os b1="c:\test.txt" os.system('notepad.exe ' + b1) However, the t of test is escaped by the \, resulting...
2
by: Craig | last post by:
I have the need to write a byte of information to a specific location in a text file. eg. the file looks something like this. FYYNN Line 1 Line 2 <eof>
13
by: George | last post by:
Hi, I am re-writing part of my application using C#. This application starts another process which execute a "legacy" program. This legacy program writes to a log file and before it ends, it...
29
by: Markus Pitha | last post by:
Hello, I read a simple bmp-file with this loop: while ( !feof(fp) ) { printf("%x\n", fgetc(fp)); } fclose(fp); Everything seems to be correct, but at the end of the file, I get a weird
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
28
by: n00m | last post by:
Both codes below read the same huge(~35MB) text file. In the file 1000000 lines, the length of each line < 99 chars. Stable result: Python runs ~0.65s C : ~0.70s Any thoughts?
9
by: tdahsu | last post by:
All, I have the following code: for fileTarget in dircache.listdir("directory"): (dirName, fileName) = os.path.split(fileTarget) f = open(fileTarget).readlines() copying = False for i in...
2
by: nikosk | last post by:
I just spent a whole day trying to read an xml file and I got stuck with the following error: Exception Type: UnicodeEncodeError Exception Value: 'charmap' codec can't encode characters in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.