Create empty file (windows-commandline.com)
The syntax of fsutil command for creating a file is:
fsutil file createnew filename requiredSize
Below is the command you can run to create a empty text file.
fsutil file createnew filename 0
Example:
C:\>fsutil file createnew emptyfile.txt 0 File C:\emptyfile.txt is created C:\>dir emptyfile.txt 02/06/2012 10:50 PM 0 emptyfile.txt C:\>
The above command can be run from a batch file also. It works on all Windows editions: XP, Server 2003, Vista, Windows 7, Server 2008.
‘fsutil‘ command should be run from elevated administrator command prompt. Otherwise, you would get the below error message.
c:\>fsutil file createnew emptyfile.txt 0 The FSUTIL utility requires that you have administrative privileges.
Using echo command
In Linux, we can use echo command also to create empty text files. This command is available in Windows also.
But using ‘echo’ we can’t create empty files. See below.
c:\> echo > newfile.txt c:\> c:\>dir newfile.txt 02/06/2012 10:47 PM 13 newfile.txt c:\>
As you can see, it has created a file of size 13 bytes.
Không có nhận xét nào:
Đăng nhận xét