banner



How To Create A File In Command Prompt Windows 10

Download Article

Download Article

Learning how to do simple file direction at the Control Prompt (cmd) comes in handy when you're learning to code. When you create files and folders at the command line, you tin can access, utilize, and manipulate those folders and files in Windows apps. Nosotros'll show you how to create folders (directories) and text files at the Windows Command Prompt, and teach yous commands for deleting unneeded files and folders.

  1. 1

    Open up the Command Prompt. The easiest mode to practice this is to printing Win + S to activate the search bar, type cmd, and then click Command Prompt in the search results.

  2. 2

    Get to the directory in which you want to create the file. The prompt will open to C:\Users\YourName by default. If the directory is somewhere else, type cd path_to_directory and press Enter. Supersede path_to_directory with the actual directory location.

    • For case, if you lot want to create a file on the Desktop, type cd desktop and press Enter.
    • If the directory you lot're looking for isn't in your user directory (eastward.k., C:\Users\YourName), you lot'll have to blazon in the whole path (e.g., C:\Users\SomeoneElse\Desktop\Files).

    Advertizement

  3. iii

    Create an empty file. If you don't want to create an empty file, skip to the side by side step. To create an empty file:

    • Type type nul > filename.txt .
    • Replace filename.txt with whatever you desire to telephone call your new file. The ".txt" part indicates that this is a patently text file. Other common file extensions include ".docx" (Give-and-take document), ".png" (empty photo),and ".rtf" (rich text document). All of these file types can be read on any Windows reckoner without installing boosted software.
    • Printing Enter.
  4. 4

    Create a file containing certain text. If you don't want to create a file with sure text inside, skip to the adjacent step. Use these steps to create a plain text file that you can type into:

    • Type copy con testfile.txt, merely supercede testfile with the desired file name.
    • Printing Enter.
    • Type some text. This is a rudimentary text editor, but it's skillful for quick notes or code. You tin can use the Enter key to get to the side by side line.
    • Press Command + Z when you lot're finished editing the file.
    • Press the Enter key. You'll see "1 file(s) copied," which means your file is now saved with the proper name you created.
    • Another way to do this is to run this command: echo enter your text here > filename.txt.
  5. 5

    Create a file that's a certain size. If you don't want to create a file that'due south a specific size, skip this step. To create a blank text file based on byte size, employ this command:

    • fsutil file createnew filename.txt one thousand .
    • Supersede filename with the desired file name, and one thousand with the actual number of bytes yous'd like the file to be.
  6. Advertisement

  1. one

    Open the Control Prompt. The easiest way to do this is to press Win + Due south to activate the search bar, type cmd, and then click Command Prompt in the search results.

  2. 2

    Go to the directory containing the file you want to delete. The prompt will open to C:\Users\YourName past default. If the file is somewhere else, type cd path_to_directory and press Enter. Supplant path_to_directory with the actual directory location.

    • For example, if you lot want to delete a file from the Desktop, type cd desktop and printing Enter.
    • If the directory you want to view isn't in your user directory (e.g., C:\Users\YourName), you'll take to type in the whole path (e.g., C:\Users\SomeoneElse\Desktop\Files).
  3. 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 Control 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 Control Prompt.
  4. iv

    Type del filename and press Enter . Supercede filename with the full proper noun and extension of the file you want to delete. File names include file extensions (e.k., *.txt, *.jpg). This deletes the file from your computer.

    • For example, to delete a text file entitled "hullo", you would type del howdy.txt into Command Prompt.
    • If the file'southward name has a infinite in information technology (eastward.one thousand., "hullo at that place"), you will identify the file's name in quotations (e.grand., del "hullo in that location").
    • If you become an error that says the file cannot exist deleted, endeavour using del /f filename instead, as this force-deletes read-only files.
  5. Advertisement

  1. 1

    Open the Control Prompt. The easiest way to do this is to press Win + Due south to activate the search bar, blazon cmd, and then click Command Prompt in the search results.

  2. 2

    Get to the directory in which yous want to create the new directory. The prompt will open to C:\Users\YourName by default. If you don't want to create a new directory hither, type cd path_to_directory and press Enter. Replace path_to_directory with the actual directory location.

    • For example, if you want to create a directory on your Desktop, you would type in cd desktop and printing Enter.
    • If the directory yous're looking for isn't in your user directory (e.g., C:\Users\YourName), you'll have to type in the whole path (eastward.g., C:\Users\SomeoneElse\Desktop\Files).
  3. 3

    Type mkdir NameOfDirectory at the prompt. Supervene upon NameOfDirectory with the name of the directory you wish to create.

    • For instance, to make a directory named "Homework", you would type mkdir Homework.
  4. 4

    Press Enter . This runs the command to create a folder with the desired name.

  5. Advertisement

  1. 1

    Open the Control Prompt. The easiest way to do this is to press Win + S to activate the search bar, type cmd, and so click Control Prompt in the search results.

  2. 2

    Go to the folder containing the directory y'all desire to delete. The prompt will open up to C:\Users\YourName by default. If the directory yous desire to delete is somewhere else, blazon cd path_to_directory and press Enter. Replace path_to_directory with the bodily directory location.

    • For example, if you want to delete a directory from your Desktop, blazon cd desktop.
    • If the directory isn't in your user directory (eastward.thousand., C:\Users\YourName), you'll have to blazon in the whole path (due east.yard., C:\Users\SomeoneElse\Desktop\Files).
  3. iii

    Type rmdir /s DirectoryName . Replace DirectoryName with the proper name of the directory you want to delete.[i]

    • For example, if yous're trying to delete your "Homework" folder, you'd type in rmdir /s Homework here.
    • If the directory's name has a space in it (east.yard., "Homework assignments"), place the name in quotations (due east.g., rmdir /due south "Homework assignments").
  4. 4

    Press Enter to run the control.

    • If you try to delete a directory that contains hidden files or directories, you lot'll see an error that says "The directory is non empty." In this example, you'll have to remove the "hidden" and "arrangement" attributes from the files inside the directory. To practise this:[two]
      • Utilise cd to change into the directory you lot desire to delete.
      • Run dir /a to view a list of all files in the directory and their attributes.
      • If you're nevertheless okay with deleting all of the files in the directory, run attrib -hs *. This removes special permissions from the undeletable files.
      • Type cd .. and press Enter to go back one directory.
      • Run the rmdir /due south command over again to delete the folder.
  5. v

    Printing y and so Enter to confirm. This volition permanently remove the directory.

  6. Advertisement

Add together New Question

  • Question

    How tin can I create directories?

    Subhodeep Roy

    Subhodeep Roy

    Community Answer

    If you lot are creating a directory in C bulldoze, the control will exist"C:\Doctor {the proper name of the directory/folder}" then press Enter.

  • Question

    How do I create a folder using CMD?

    Community Answer

    Navigate to where y'all desire the subfolder created and blazon "mkdir ".

  • Question

    How do I create a exam file under the sub folder?

    Community Answer

    Modify directory into the new sub binder and then on the next line, create your new test file. For case: cd mysubfolder $ type nul > newtextfile.txt

  • Question

    I have done the null matter but its not working. How exactly practice I create a test file in a subfolder?

    Community Answer

    Type 'nul' with a unmarried 'l'. It seems you have mistakenly typed 2 Ls. For example: type nul > filename.extn.

  • Question

    HoW do I create multiple php files using only one command in the window?

    Community Answer

    To execute multiple commands at once you lot use two ampersands connecting the commands. instance:"type nul > filename.php && type nul > filename.php" you tin can do that more times if you desire.

  • Question

    How tin can I edit a file through the command prompt?

    Kyle Peck

    Kyle Peck

    Community Answer

    If you use echo "content you lot want to add together" >> filename.txt, you volition update the content in the file. But be conscientious, echo "content you want to add" > filename.txt will overwrite all of the content in the file and replace it.

  • Question

    Is there any manner I can adjust the clock on my desktop without having the administrator having to log in?

    Community Answer

    There isn't whatsoever way. This is a setting, and it must be done by the ambassador of the figurer.

  • Question

    I created a 'private' folder using a questionable .batch file. Later deleting the suspicious binder, information technology comes right dorsum when I employ Microsoft Photos app. Can yous assistance me uninstall it?

    Rudy Toth

    Rudy Toth

    Customs Reply

    Do the post-obit... (can yous get to the command prompt, non using Windows? Do yous know how to gain access to the command prompt, beingness outside of Windows?) That may exist the black screen with your cursor blinking at the upper left corner. Try this syntax and you must type information technology correctly also: C:\Windows\folder name\name of your batch file.bat erase. For case: C:\Windows\Rocker\HeavyMetal.bat erase then type CLS and then type EXIT.

Ask a Question

200 characters left

Include your email address to get a message when this question is answered.

Submit

Advertisement

Video

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

Ad

About This Article

Article Summary X

1. Use the mkdir control to create a folder.
2. Employ rmdir /southward to delete a folder.
3. Apply the copy con or repeat command to create a file.
4. Use del to delete a file.
For tips on how to create a file inside a binder, read on!

Did this summary assistance you?

Cheers to all authors for creating a page that has been read 971,431 times.

Is this article up to date?

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

Posted by: hyderuntly1938.blogspot.com

0 Response to "How To Create A File In Command Prompt Windows 10"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel