How to modify a .txt file using .bat?

Solved
-  
Hello, I am asking this question on the forum because
I do not know how to modify a .txt with a .bat

Example:
I want that in the .bat I can
add a sentence in a .txt "contact"

Thank you in advance

Best regards,
Johan

1 answer

  1. Moderator
    Hi,

    echo contact >> %Path%
    0
    1. I didn't understand everything, can you explain it to me?
      0
    2. Moderator
      @TheKiller3-johanCan you tell me where your text file is located?

      And/or what it is named?
      0
    3. @fabulOf course, my text file is located at: C:\Users\Megaport\Desktop\test\test.txt
      0
    4. Moderator
      @TheKiller3-johanecho contact >> C:\Users\Megaport\Desktop\test\test.txt

      Or

      echo contact >> %UserProfile%\Desktop\test\test.txt

      Or

      (If your .bat is in the same folder as your .txt)

      echo contact >> %test.txt
      0
    5. @fabul
      echo The text you want >> %lenomdetontxt.txt 

      echo The text you want >> %UserProfile%\Desktop\lenomdeetontxt.txt 

      Thank you very much!
      0