一个箭头→字符得到appeded的文件在蝙蝠脚本 [英] an arrow → character getting appeded to files in a .bat script

查看:182
本文介绍了一个箭头→字符得到appeded的文件在蝙蝠脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的脚本获取与.new_tmp扩展,并将它们复制所有文件具有相同的名称,但没有.new_tmp扩展名的文件。除了评论被放置在该文件的顶部和.new_tmp文件被删除。

The following script gets all files with .new_tmp extension and copies them to a file with the same name but without the .new_tmp extension. In addition a comment is placed at the top of the file and the .new_tmp file is deleted.

echo ^<?php /* > start.tmp
echo */ ?^> > end.tmp
for /R "./mydir" %%I in (*.new_tmp) do (
    copy start.tmp+license.txt+end.tmp+%%I worker.tmp
    move worker.tmp %%~pI%%~nI
    del %%I
)

的问题是,面向箭头→右被附加到所有文件的底部

The problem is that a right facing arrow → gets appended to the bottom of all the files

为什么这个角色得到追加到所有文件的结尾?

Why is this character getting appended to the end of all the files?

更新
我想这与一个非常简单的例子,并得到了相同的结果。

UPDATE I tried this with a much simpler example and got the same results

copy NUL worker.tmp
copy worker.tmp + license.txt + license.txt + license.txt

同样的问题,在最后的箭头...

Same problem, an arrow at the end...

我在Windows 7上运行。

I am running under Windows 7

推荐答案

箭头是由复制命令用来连接时,附加一个CTRL-Z的ASCII字符文件用 + 选项。

The arrow is a CTRL-Z ascii char that is appended by the COPY command when used to concatenate files with the + option.

要prevent 复制追加CTRL-Z字符,请使用 COPY / B 的二进制副本。

To prevent COPY to append the CTRL-Z character, use COPY /B for a binary copy.

所以,你的命令将是

COPY /B start.tmp+license.txt+end.tmp+%%I worker.tmp

这篇关于一个箭头→字符得到appeded的文件在蝙蝠脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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