数字写入到一个文本文件 - 批处理文件 [英] Writing Numbers to a text file - batch file
问题描述
这应该是一个简单的,我很失望与自己,但不能为我的生活找到一个解决办法!我想1号写在BAT脚本的文本文件。如果我做下面的工作原理,但我不能有号码后留下了尾随空格。我知道你可以通过删除1和>(这个作品用字母)之间,但与数字突然我得到一个消息,说空间删除尾随的空间 - ECHO为OFF
ECHO 1> mytextfile.txt
*这工作,但留下了尾随空格*ECHO 1> mytextfile.txt
*这给了我一个错误说ECHO为OFF *
的问题是,回声1 GT; myTextFile.txt
不会回显 1
,而不是echo命令为空,重定向去流1
您可以重定向干脆转移到前面。
> mytextfile.txt回声1
This should be a simple one and I am dissapointed with myself but cant for the life of me find a solution! I am trying to write the number 1 to a text file in a BAT script. If I do the below it works but leaves a trailing space after the number which I cannot have. I know you can remove the trailing space by deleting the space between the 1 and the > (this works with letters) but with numbers all of a sudden I get a message saying - ECHO is OFF.
ECHO 1 > mytextfile.txt
*This works but leaves a trailing space*
ECHO 1> mytextfile.txt
*This gives me an error saying ECHO is OFF*
The problem is that echo 1> myTextFile.txt
will not echo 1
, instead the echo command is empty and the redirection goes to stream 1.
You could simply move the redirection to the front.
>mytextfile.txt echo 1
这篇关于数字写入到一个文本文件 - 批处理文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!