批处理脚本以合并不包含十六进制字符1A的文件 [英] Batch script to merge files without Hex char 1A at the end

查看:81
本文介绍了批处理脚本以合并不包含十六进制字符1A的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过这样的简单批处理脚本合并两个ASCII文件

I'm merging two ASCII files via a simple batch script like this

COPY a.txt+b.txt c.txt /y /a

问题在于,C语言中的最后一个字符被设置为1A,即SUB的十六进制表示法. c.txt被送入另一个不喜欢最后的1A的可执行文件.

The problem is, the very last character in C gets set to 1A, the HEX notation for SUB. c.txt is fed into another executable which does not like the 1A at the end.

生成c.txt后,如果我在Notepad ++中将其打开并删除最后一个字符,则文件可以正常工作.

After c.txt is generated, if I open it up in Notepad++ and remove the last character, the file works fine.

我如何合并a.txtb.txt而不将1A附加到c.txt的末尾?

How could I merge the a.txt and b.txt without 1A getting appended to the end of c.txt ?

推荐答案

/a/b开关的位置至关重要.根据它们是放在源文件名还是目标文件名之后,它们的性能有所不同.

The placing of /a and /b switches is critical. They perform differently depending on whether they are placed after the source filename(s) or the target filename.

与目标文件名一起使用时,/a导致添加文​​件结束标记(ASCII 26).您实际上是在指定这个!

When used with a target filename, /a causes the end-of-file marker (ASCII 26) to be added. You are actually specifying this!

/a指定文件为ASCII,并将其复制到(但不包括)第一个ASCII 26文件结尾标记.该字符及其后的所有内容都会被忽略.

/a specifies the file is ASCII and it's copied up to but not including the first ASCII 26 end-of-file mark. That character and anything after it is ignored.

/b导致整个文件被复制,包括文件结尾标记及其后的所有内容.

/b causes the entire file to be copied, including any end-of-file markers and anything after them.

/a导致将ASCII 26添加为最后一个字符.

/a causes ASCII 26 to be added as the last character.

/b不会将ASCII 26作为最后一个字符添加.

/b does not add ASCII 26 as the last character.

...虽然我还没有测试过,可能还是可以使用

...although I haven't tested it, is probably to use

COPY a.txt+b.txt /a c.txt /b /y

这篇关于批处理脚本以合并不包含十六进制字符1A的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆