Create and delete files and folders from the command prompt

Author: Judy Howell
Date Of Creation: 2 July 2021
Update Date: 1 July 2024
Anonim
Windows command prompt tutorial 2 - making folders, deleting folders, creating and deleting files
Video: Windows command prompt tutorial 2 - making folders, deleting folders, creating and deleting files

Content

The Windows Command Prompt can be a great way to complete tasks quickly and efficiently. It is a very powerful and often overlooked tool in computing. The Command Prompt is a mouse-free environment and ideal for those who prefer to do their work from the keyboard. In this article, you will get an initial explanation of the command prompt and how to use it for some basic tasks. After reading this article, you should be able to use Command Prompt for basic tasks with a little more ease.

To step

  1. Open the Windows command prompt. Click on the start screen of your computer and go to the search field. Type "command prompt" or "cmd". Double-click Command Prompt in the search results list to open Command Prompt. The command prompt will look like this: C: users User>.
  2. Create a new directory. The "mkdir" command creates a new folder or directory to work with. The command is "mkdir directory name". In the example above, a new folder called wikihow is created by typing: mkdir wikihow.
  3. Change the current working directory. To change to the new directory, use the command "cd" (change directory). The command is "cd folder name". In the example you see cd wikihow. Now the prompt looks like this: C: users User wikihow> as stated above.
  4. Check the contents of the directory. Use the dir command to check the contents of the current directory. Type dir and press Enter to list the active directory contents. In the example, the wikiHow directory is currently empty.
  5. Clear the screen. To clear the screen, use the "cls" command. Type cls and press Enter if you want to clear the contents of the screen. Only the command prompt will remain on the screen, as shown above.
  6. Create a new file. To create a new file, use the command "type ZERO> filename". Type: "type ZERO> filename" and press Enter to create a new empty file. As in the example above, type type ZERO> newFile.
  7. Add another new file to it. Repeat step 5 to create another new file. This file is called newFile1. The assignment is: type ZERO> newFile1.
  8. Check the contents of a directory. Check the directory contents with the "dir" command. The wikiHow directory now contains two new files newFile and newFile1, as noted above.
  9. Delete files. To delete files, use the "del" command. Type "del filename" to delete a specific file. In this example, we delete newFile with the following command: del newFile. Now check the contents of the wikiHow folder and you will see that newFile has been deleted. Clear the screen using the "cls" command.
  10. Go to the parent folder. To perform the next step (deleting a folder), go out of the current working directory. To do this, use a variation of the "cd" command. Use the command "cd .." to go to the parent directory without typing the directory name. Type CD.. as indicated above. You will see that the prompt has now gone back to "C: users User>" which means that you are no longer in the wikiHow directory.
  11. Delete an empty folder. To delete a folder, use the command "rmdir". You cannot be in the folder you want to delete (see step 10 above). If the folder is empty (meaning there are no files in it) then you can delete it simply by rmdir directory name typing. In this example, the wikiHow directory still contains newFile1, and the "rmdir" command will not work in this case. If the folder is not empty, you will get an error as shown above.
  12. Delete a folder that does contain files. You can delete a folder that contains files with a modified version of the "rmdir" command. The "rmdir / s" command. Type rmdir / s wikiHow and hit Enter. You will be asked to confirm that you want to delete the folder by typing Y or N. Type Y for Yes or N. for No, as shown above. When you enter Y, the entire folder and all its contents are deleted from the system.

Tips

  • Commands are not case sensitive.
  • Use the "cls" command regularly to clear the screen. This makes your work easier to read.

Warnings

Using the command prompt takes practice, and care should be taken when moving and deleting files. There are no warnings or second chances when deleting files, so it is important to make sure you delete the correct files to avoid losing important documents.


Necessities

  • Computer with the Windows operating system
  • Keyboard