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 the Notepad text editor with a new file named
newfile.txt
. You can then save the file by clicking on "File" > "Save" or pressing Ctrl+S.
Note: Make sure to replace newfile.txt
with the desired name and extension for your new file.