Mukhbir

 
  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • green color
  • blue color

Create a folder and file in it with some text using .BAT file

E-mail Print PDF

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.

Comments (0)Add Comment
Write comment
 
  smaller | bigger
 

busy
Last Updated ( Sunday, 18 January 2009 11:25 )