Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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:

StartAgents=9

WITHOUT space at the end of line.

Unfortunately command:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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 

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

Example:

echo StartAgent=^9>>test.txt

Related Information:

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading