CMD/BATCH BAT SCRIPT How to add digit to file without space

i want to make a start.config file by using bat script.
I want to add to my config file that parameter:


WITHOUT space at the end of line.

Unfortunately command:

echo StartAgents=9>>C:\start.config

not working, I think that there is "collision" with two characters: "9>"


echo StartAgents=9 >>C:\start.config

is working, but this is adding space at the end of line in my config file – i dont want that.

Any ideas how to do that?

I want to add line StartAgents=9 without space af the end of line.


dont want:


>Solution :

You have to escape the number, so that it isn’t interpreted by CMD.EXE as a file descriptor number.

Then you can add the >> redirection directly after the number to not insert a trailing space.


echo StartAgent=^9>>test.txt

Related Information:

Leave a Reply