In order to create a specific directory, with a file in it containing specified text, there are basically two steps involved,
One, creating the directory using:
mkdir C:\directory-name
and then creating the file with the following code: (please note, that this will create a new file with this name if it does not exist, otherwise it will update the previous file already present at the specified location and replace the previous text / data in it.)
echo text-to-be-added > "c:\directory-name\file-name"
So the final code looks like this:
@echo off
mkdir C:\directory-name
echo text-to-be-added > "c:\directory-name\file-name"
Save this code in a .bat file and run, this will create the desired folder, and file having specified text in it.
Set as favorite
Bookmark
Email This
Hits: 153
Comments (0)










