Home How To How to : How to Create and Delete Files and Directories from Windows Command Prompt

How to : How to Create and Delete Files and Directories from Windows Command Prompt

0
How to : How to Create and Delete Files and Directories from Windows Command Prompt

[ad_1]

Method 1
Method 1 of 4:

Creating a File

  1. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 10


    1
    Open the Command Prompt. The easiest way to do this is to press Win + S to activate the search bar, type cmd, and then click Command Prompt in the search results.
  2. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 11

    2
    Go to the directory in which you want to create the file. The prompt will open to C:UsersYourName by default. If the directory is somewhere else, type cd path_to_directory and press Enter. Replace path_to_directory with the actual directory location.[1]

  3. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 12

    3
    Create an empty file. If you don’t want to create an empty file, skip to the next step.[2]
  4. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 13

    4
    Create a file containing certain text. If you don’t want to create a file with certain text inside, skip to the next step.[3]
  5. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 14

    5
    Create a file that’s a certain size. If you don’t want to create a file that’s a specific size, skip this step.[5]

Method 2
Method 2 of 4:

Deleting a File

  1. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 15

    1
    Open the Command Prompt. The easiest way to do this is to press Win + S to activate the search bar, type cmd, and then click Command Prompt in the search results.
  2. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 16

    2
    Go to the directory containing the file you want to delete. The prompt will open to C:UsersYourName by default. If the file is somewhere else, type cd path_to_directory and press Enter. Replace path_to_directory with the actual directory location.

    • For example, if you want to delete a file from the Desktop, type cd desktop and press Enter.
    • If the directory you want to view isn’t in your user directory (e.g., C:UsersYourName), you’ll have to type in the whole path (e.g., C:UsersSomeoneElseDesktopFiles).
  3. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 17

    3
    Type dir and press Enter. This displays a list of all files in the current directory. You should see the file you want to delete in this list.

    • Using Command Prompt to delete files results in the files being deleted permanently rather than being moved to the Recycle Bin. Exercise caution when deleting files via Command Prompt.
  4. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 18

    4
    Type del filename and press Enter. Replace filename with the full name and extension of the file you want to delete.[6]
Method 3
Method 3 of 4:

Creating a Folder

  1. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 1

    1
    Open the Command Prompt. The easiest way to do this is to press Win + S to activate the search bar, type cmd, and then click Command Prompt in the search results.[7]
  2. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 2

    2
    Go to the directory in which you want to create the new directory. The prompt will open to C:UsersYourName by default. If you don’t want to create a new directory here, type cd path_to_directory and press Enter. Replace path_to_directory with the actual directory location.[8]
  3. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 3

    3
    Type mkdir NameOfDirectory at the prompt. Replace NameOfDirectory with the name of the directory you wish to create.[9]
  4. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 4

    4
    Press Enter. This runs the command to create a folder with the desired name.
Method 4
Method 4 of 4:

Deleting a Folder

  1. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 5

    1
    Open the Command Prompt. The easiest way to do this is to press Win + S to activate the search bar, type cmd, and then click Command Prompt in the search results.[10]
  2. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 6

    2
    Go to the folder containing the directory you want to delete. The prompt will open to C:UsersYourName by default. If the directory you want to delete is somewhere else, type cd path_to_directory and press Enter.[11]
  3. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 7

    3
    Type rmdir /s DirectoryName. Replace DirectoryName with the name of the directory you want to delete.[12]
  4. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 8

    4
    Press Enter to run the command.[13]
  5. Image titled Create and Delete Files and Directories from Windows Command Prompt Step 9

    5
    Press y and then Enter to confirm. This will permanently remove the directory.[15]

Video

By using this service, some information may be shared with YouTube.



Tips

Submit a Tip

All tip submissions are carefully reviewed before being published

Thanks for submitting a tip for review!

Warnings

  • Using Command Prompt to delete files results in the files being deleted permanently rather than being moved to the Recycle Bin. Exercise caution when deleting files via Command Prompt.

    ⧼thumbs_response⧽

You Might Also Like

Delete a File Using Command Prompt

Delete a File Using Command Prompt

Change Directories in Command Prompt

Change Directories in Command Prompt


Copy Files in Command Prompt

Copy Files in Command Prompt

Run an EXE File From Command PromptHow to Run an EXE File at the Windows Command Prompt

Open a Folder in CmdHow to Open a Folder in Command Prompt (CMD)

Format a USB Using CmdHow to Format a USB Using CMD (Command Prompt)

Use Net Send

Use Net Send

Use Windows Command Prompt to Run a Python File

Use Windows Command Prompt to Run a Python File

Go Back Using the Command Prompt

Go Back Using the Command Prompt

Add Users from CMD

Add Users from CMD

Watch Star Wars on Command Prompt

Watch Star Wars on Command Prompt

Merge Text (.Txt) Files in Command Prompt

Merge Text (.Txt) Files in Command Prompt

Run a Program on Command PromptHow to Run a Program at the Windows Command Prompt: 2 Ways

Open Command Prompt with a Keyboard Shortcut (Windows 8, 8.1, and 10)3 Ways to Open Command Prompt with Keyboard on Windows

[ad_2]

Source link : https://www.wikihow.com/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt

LEAVE A REPLY

Please enter your comment!
Please enter your name here