How to create new file in cmd
To create a new file in the Command Prompt (Cmd), you can use the following methods:
Method 1: Using the type
command
- Open the Command Prompt (Cmd).
- Type the following command and press Enter:
type nul > newfile.txt
This will create a new file named
newfile.txt
in the current directory.
Method 2: Using the echo
command
- Open the Command Prompt (Cmd).
- Type the following command and press Enter:
echo. > newfile.txt
This will create a new file named
newfile.txt
in the current directory.
Method 3: Using the touch
command (in Windows 10 and later)
- Open the Command Prompt (Cmd).
- Type the following command and press Enter:
touch newfile.txt
This will create a new file named
newfile.txt
in the current directory.
Method 4: Using a text editor
- Open the Command Prompt (Cmd).
- Type the following command and press Enter:
notepad newfile.txt
This will open Notepad and create a new file named
newfile.txt
in the current directory.
Note: Replace newfile.txt
with the desired name and location of the file you want to create.
After creating the file, you can edit it using a text editor like Notepad, or use other commands like copy
or move
to manipulate the file.