Create a new file in command prompt
To create a new file in Command Prompt, you can use the following methods:
Method 1: Using the type
command
- Open Command Prompt.
- 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 Command Prompt.
- Type the following command and press Enter:
echo. > newfile.txt
This will create a new file named
newfile.txt
in the current directory and add a blank line to it.
Method 3: Using the touch
command (in Windows 10 and later)
- Open Command Prompt.
- 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 Command Prompt.
- Type the following command and press Enter:
notepad newfile.txt
This will open Notepad and create a new file named
newfile.txt
. You can then edit the file and save it.
Note: Replace newfile.txt
with the desired name of your file.