2 Methods to Create Empty File on Windows

2 Methods to Create Empty File on Windows

In the Windows system, mastering command line operations for files and directories is a fundamental skill for both regular users and administrators. Being able to efficiently create and manage files is essential for effective system maintenance and workflow efficiency. One of the basic tasks you'll often need to perform is creating an empty file. This tutorial provides 2 methods how to create empty file on Windows.

Method 1 - CMD

Use the type command with NUL to create an empty file:

type NUL > test.txt

This command will create a new file named test.txt with no content.

Method 2 - PowerShell

In the PowerShell window, use the New-Item cmdlet to create a new empty file:

New-Item test.txt -ItemType File -Force

The -Force is an optional parameter that forces the creation of the file, even if it already exists. It will overwrite the file with a new empty file.

Leave a Comment

Cancel reply

Your email address will not be published.