How to Create a File With a Command Prompt

by Lori Kaufman

The Windows Command Prompt gives you a way to communicate with the operating system directly and perform a wide variety of tasks, such as acquiring network information, troubleshooting the operating system and even creating new files. You can create any type of file from the Command Prompt; you can even specify the size you want the file to have when you create it. Creating a file in this manner involves typing just a few commands.


Press "Windows-X" to open the Windows Tools menu, and then choose "Run" from the menu to open the Run window.


Type "cmd" without the quotes and press "Enter" to open the Command Prompt.


Change the working directory to the directory in which you wish to store the file. To select a specific directory, use the "cd" command – for example, "cd your_directory." To move up one directory, use the "cd.." command. To change the drive, use the "DriveLetter:" command; for instance, select drive "D" by using the "D:" command. To open the "Sample" directory, use the "cd Sample" command. If "Sample" is the wrong directory, use the "cd.." command to move up one directory and then use the "cd DirectoryName" command to open the correct folder.


Run the "fsutil file createnew" command, followed by the name and extension of the file and its size, to create a new file. For example, to create a new MP3 file, use the "fsutil file createnew sample.mp3 1024" command. The size is in bytes, so the sample.mp3 file will be 1KB (1024 bytes) in size.


Close the Command Prompt.