Currently I've tried the following: set /p output = < output.txtset output =>> output.txtset output = >> output.txt and set output = ">> output.txt", however none of them seem to be working.
Try escaping your carats: set output = ^>^> output.txt echo "string to write to file with quotes" %output%
我发现了我遇到的问题。显然,如果您尝试将文件名放入变量中,Windows bat 文件会抛出错误。这意味着我想要的解决方案没有实际意义。
I've found the issue I was encountering. Apparently windows bat files will toss errors if you try to put a file name in the variable. This means that my intended solution is moot point.
发布评论
评论(3)
您的描述非常不清楚,但如果我理解正确,您想要一些简单的东西,例如 echo:
(如果您想附加数据而不覆盖现有数据,请将 > 更改为 >>)
Your description is very unclear, but if I understand you correctly you want something simple like echo:
(Change > to >> if you want to append data and not overwrite the existing data)
目前我已尝试以下操作:
set /p output =
output.txt
设置输出=>>输出.txt
设置输出=>> output.txt
和set output = ">>output.txt"
,但是它们似乎都不起作用。尝试转义您的克拉:
设置输出 = ^>^>;输出.txt
echo“用引号写入文件的字符串”%output%
Currently I've tried the following:
set /p output = < output.txt
set output =>> output.txt
set output = >> output.txt
andset output = ">> output.txt"
, however none of them seem to be working.Try escaping your carats:
set output = ^>^> output.txt
echo "string to write to file with quotes" %output%
我发现了我遇到的问题。显然,如果您尝试将文件名放入变量中,Windows bat 文件会抛出错误。这意味着我想要的解决方案没有实际意义。
I've found the issue I was encountering. Apparently windows bat files will toss errors if you try to put a file name in the variable. This means that my intended solution is moot point.