Insert Text into a File with CMD

Tech

This is How to Insert Text into a File via Command Line:

1. specify the directory of the file:
cd PATH\TO\FOLDER-NAME
2. Inserting a text into the file with cmd:
echo YOURCONTENTHERE > filename.txt
3. Inserting a new blank line into the file with cmd:
echo. >> filename.txt

Notes:
you can use %CD% as current path.
you can use %USERPROFILE% as user profile path.
Remember that for folders with spaces in the name or folders larger than 8 characters in length, it is a good idea to put quotation marks around the path as in the figure above or you may get an error.
If the file path or name has a space in it (e.g., “hi there”), you will place the file path or name in quotations (e.g. “D:\hi there”).

Sharing is caring!

DZ4Team

DZ4Team is a Web development team, We offer all types of scripts, installing, supporting and hosting. Contact Us: https://fb.com/DZ4TeamSupport

https://dz4team.com

Leave a Reply