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

Time:12-30

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

StartAgents=9

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>"

Command:

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. want:

StartAgents=9

dont want:

StartAgents=9 

CodePudding user response:

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.

Example:

echo StartAgent=^9>>test.txt

Related Information:

  • Related