HOW TO CREATE FILES USING WINDOWS COMMAND PROMPT

You've got this. Creating a file using windows command prompt has never been simpler!

By Lloyd Harris | June 6, 2020.

I have read over 100 questions regarding this subject on Quora and other online platforms and thought this would make for an interesting article.

This tutorial demystifies the process of creating and deleting a file in Windows using the command prompt. This is a step-by-step tutorial that assumes the user is running Windows 8 or Windows 10.

There are multiple procedures system admins and superusers can use to accomplish the same result. Since deemystify.com ‘s objective is to present technology using a simple approach, I have chosen two widely used methods for accomplishing the task of creating and deleting a file using the Windows command prompt.

There is a video link at the end of this tutorial if you’d like to skip the rest of this article. The video was made with a trial product. Please cut me some slack.

Step 1: Launch the Windows Command Prompt. At your prompt, type cd\ and press Enter ( on most keyboards, the backslash \ symbol is located above the Enter key).

Step 2: Create a sample directory and name it, “ PleaseKeepMyFiles” ( a directory is just an ancient name for a folder). In case you’re wondering, the directory is where you are going to store your file(s). Syntax of the make directory command: md PleaseKeepMyFiles, Enter

Step 3: Confirm the existence of your directory using windows by clicking on Windows Explorer from the taskbar and searching for the directory’s name. Once you confirm the existence of your new directory. Proceed to Step 4.

Step 4: To make life easier, using the command prompt, step inside of your directory, then create the file.Syntax of the change directory command: cd PleaseKeepMyFiles, Enter.

Now, let’s create our file(s) using two commonly used methods:

: -> This command lets you create a file and input characters before saving the file. When you are done typing, save the file by holding down the “Ctrl” PLUS “Z” keys on your keyboard. Syntax of the copy con command: copy con fileName.rtf, Enter to start typing your characters. Hold “Ctrl” + “Z” when you’re done.

: -> This command lets you create an empty file. Syntax of the nul command: At your command prompt, type nul > fileName.rtf, and Enter. ( you may replace the fileName.rtf with any name)

Bonus: Updating An Existing File

Like any document processor, the command prompt allows you to update your existing file with new contents. The command to use this feature is called “echo”. Let’s use this command on the empty file created using method 2.

Step 5: Echo, as the name reflects is a command that outputs whatever string (characters) that are given to a command shell. Use the below command to add new content to the empty file. Syntax of the echo command: echo This is my first entry into my empty file. > fileName.rtf

Step 6: Add additional comments to the file using the echo command and a double tag. This time around, you will want to use two greater than (>>) sign symbols to update your file contents. A single greater than sign, symbol will erase all contents in the file with your immediate entry, beware! Syntax: echo This is my second entry. >> fileName.rtf

Step 7: Check or view the contents of the file you just updated using the type command.

Syntax of the type command:type fileName.rtf Enter. (your file should now have more than two lines or sentences.

Step 8: Delete your file by using the delete command.

Syntax of the delete command:del fileName.rtf Enter. (this action will move your file to the recycle bin of your computer).

Step 9: Exit the command prompt by typing “exit”

 

Video Link: https://youtu.be/zyOv0CUJEww

Please subscribe, like, and share.

Published by Lloyd Harris

I am a technology enthusiast.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: