There are two command that you can use to create a file from a command line in Windows 10. These include
– echo
– fsutil
How to create a file from a Command line in Windows 10 ?
The fsutil command can be used to create a file by specifying the size but if you need to write a data to the file during its creation , you can use the echo command.
Syntax of fsutil command
fsutil file createnew <Name_Of_the_File> <No_Of_Bytes>
Syntax of echo command
echo file_content > name_of_the_file.txt
Example
D:\abundantcode2>echo "welcome to abundantcode.com" > abundantcode.txt
D:\abundantcode2>dir
Volume in drive D is New Volume
Volume Serial Number is 1E5B-86FF
Directory of D:\abundantcode2
07/28/2016 02:22 PM <DIR> .
07/28/2016 02:22 PM <DIR> ..
07/28/2016 02:22 PM 32 abundantcode.txt
1 File(s) 32 bytes
2 Dir(s) 327,704,076,288 bytes free
D:\abundantcode2>
Leave a Reply