Create File From Command Line In Windows

In windows version operating system we need to create text file to do something like others. This can you create manually or you can create file from the command line in windows.

You can create files from command line with two ways. Both of ways are easy and effective. Firstly you can create file via using the command is fsutil and second is echo command.

Create File From Command Line

Here some different on these command. If you wish to create some specific date or time in the file then chose the echo command. On the other had you don’t need or write date option on the field but just want to create a file of some specific size. Then you just use fsutil command for better result. So, let’s see the detail update with command line.

When You Create a File With echo

echo write-sometext  > filename.txt

For Example: 

C:>echo This is a sample text file > sample.txt
C:>type sample.txt
This is a sample text file
C:>

Create File Using fsutil

fsutil file createnew filename number_of_bytes

For Example:

C:data>fsutil file createnew sample2.txt 2000
File C:datasample2.txt is created
C:data>dir
01/23/2016  09:34 PM     2,000 sample2.txt
C:data>

Restriction:
Fsutil can be used only by the administrators. In you are non admin then you can face some error like below.

c:>fsutil file /?

The FSUTIL utility requires that you have administrative privileges.
c:>

So, finally you are understand how can you create a file from the command line maybe! This post help you do the main topic successfully I hope. Feel free to ask me if you have any reason to ask. 

Leave a Comment