Creating a .txt file with multiple echoed lines of text fails depending on the text
I'm a casual coder trying to make a bat file that writes a txt file with multiple lines of text and it's not working for some reason. My code so far for reference:
@echo off
(
Echo;extends "res://Mod Data.gd"
Echo;
Echo;func_init():
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
) > "Output\custom.txt"
pause
(It might be unnecessary to put all the test stuff here but I put it there just incase that's what's causing it.)
When I try to run it, it closes instantly and doesn't work, but if I try to run it without "func_init():" it works like a charm.
Also, I made another bat file testing this out by only printing "func_init():" and that worked just fine as well, so I have no clue what this could be.
Batch isn't smart enough to know that the )
in Echo;func_init():
isn't the end of the code block, so right now your script is aborting because it thinks the :
is a syntax error. You can get around this by using the ^
character to escape the close parenthesis.
@echo off
(
Echo;extends "res://Mod Data.gd"
Echo;
Echo;func_init(^):
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
Echo;test
) >"Output\custom.txt"
pause