Cmd Prompt + Command to Make Dos Look at External Commands Again

How to use the Windows control line (DOS)

Updated: 12/31/2020 past Computer Promise

Windows command line (DOS)

This page covers the basics of navigating and using the Microsoft Windows control line. On this page, y'all learn how to move around in the control line, notice files, manipulate files, and other important commands. Keep in mind that there are over 100 different commands used in MS-DOS and the Windows command line. If you are interested in learning about the command line in more than detail, encounter our DOS and command prompt overview, which gives a clarification and example for every command.

Get into the Windows command line

Open a Windows command line window by following the steps beneath. If you need additional information or alternative methods for all versions of Windows, see: How to become to an MS-DOS prompt or Windows command line.

  1. Click Start.
  2. In the Search or Run line, type cmd (brusk for control), and press Enter.

Understanding the prompt

Afterwards post-obit the steps to a higher place, the Windows control line should be shown (similar to the instance below). Windows oftentimes starts y'all at your user directory. In the instance beneath, the user is Mrhope. So, C:\Users\Mrhope> is our prompt. This prompt shows that we're in the C: drive (default hard drive letter of the alphabet) and currently in the Mrhope directory, a subdirectory of the Users directory.

Windows command line

Primal tips

  • MS-DOS and the Windows command line are not instance sensitive.
  • The files and directories shown in Windows are as well found in the control line.
  • When working with a file or directory with a space, surround it in quotes. For example, the directory My Documents would exist "My Documents" when typed.
  • File names can have a long file proper noun of 255 characters and a 3 graphic symbol file extension.
  • When a file or directory is deleted in the command line, it is non moved into the Recycle Bin.
  • If you need assistance with whatsoever of control, type /? afterward the command. For example, dir /? would give the options available for the dir command.

Listing the files

Let'south acquire your first command. Type dir at the prompt to list files in the electric current directory. You should become an output like to the example paradigm beneath. Without using any dir options, this is how dir output appears. Equally shown, you are given lots of useful information including the cosmos date and time, directories (<DIR>), and the name of the directory or file. In the instance below, there are 0 files listed and 14 directories, indicated past the status message at the bottom of the output.

Listing files in the Windows command line

Every command in the command line has options, which are additional switches and commands that can be added later on the command. For example, with the dir command, y'all tin can type dir /p to list the files and directories in the electric current directory i page at a time. This switch is useful to see all the files and directories in a directory with dozens or hundreds of files. Each of the command options and switches is listed in our DOS command overview. We offer guides for individual commands, as well. For example, if y'all want to meet all the options for the dir command, refer to our dir command overview for a complete pick listing.

The dir command can also exist used to search for specific files and directories using wildcards. For example, to list files or directories that begin with the letter of the alphabet "A" you could type dir a* to list only the AppData directory, in this above instance. See the wildcard definition for other examples and help with using wildcards.

  • How to list files in a directory or folder on the calculator.

Moving into a directory

Now that we've seen a list of directories (shown below) in the current directory, motility into 1 of those directories. To move into a directory, we use the cd command, and so to move into the Desktop type cd desktop and press Enter. Once you've moved into a new directory, the prompt changes. So, in our example, the prompt is now C:\Users\Mrhope\Desktop>. You can run across what files are institute in this directory past typing the dir command over again.

Windows command line listing Desktop files

  • How to change a directory or open a folder.

Sympathise the files

In the Desktop directory, as shown in the in a higher place example, in that location are 23 files and vii directories, representing different file types. In Windows, you are familiar with files having icons that assist represent the file blazon. In the command line, the aforementioned thing is achieved by the file extensions. For example, "forum posts.txt" is a text file because information technology has a .txt file extension. Time.mp3 is an MP3 music file and minecraft.exe is an executable file.

  • Listing of file extensions and additional help with file extensions.

Most users are simply concerned with executable files, which as mentioned to a higher place, are files ending with .exe, .com, and .bat. When the file name is typed in the command line, the plan runs, which is the same equally double-clicking a file in Windows. For example, if nosotros wanted to run minecraft.exe, typing minecraft at the prompt runs that program.

Note

Continue in mind that if the executable file you are trying to run is not in the current directory, yous become an fault. Unless you have gear up a path for the directory with the executable file, which is how the command line finds external commands.

If you desire to view the contents of a file, about versions of the command line utilise the edit control. For instance, if we wanted to look at the log file hijackthis.log, nosotros would blazon edit hijackthis.log at the prompt. For 64-bit versions of Windows that do non support this control, you can employ the first control (e.thousand., blazon kickoff notepad hijackthis.log) to open the file in Notepad. Additional information nigh opening and editing a file from the control line is available on the page linked below.

  • How to open, view, and edit the contents of a file on a computer.

Moving dorsum a directory

You learned before the cd command can motility into a directory. This command also allows you to go back a directory by typing cd.. at the prompt. When this command is typed, you'll be moved out of the Desktop directory and back into the user directory. To move back to the root directory blazon cd\ to get to the C:\> prompt. If you know the name of the directory you want to move into, you can also type cd\ and the directory name. For example, to motion into C:\Windows>, type cd\windows at the prompt.

  • How to alter a directory or open a folder.

Creating a directory

Now with your basic agreement of navigating the command line, let's start creating new directories. To create a directory in the current directory, use the mkdir command. For example, create a directory called "test" by typing mkdir test at the prompt. If created successfully, you are returned to the prompt with no mistake message. After the directory is created, move into that directory with the cd command.

  • How to create a directory or folder.

Switching drives

In some circumstances, y'all may want to copy or list files on another drive. To switch drives in the Windows control line, blazon the drive letter of the drive followed by a colon. For example, if your CD-ROM drive is the D drive, you would type d: and press Enter. If the drive exists, the prompt changes to that drive alphabetic character. If the drive does not exist or is not accessible (due east.grand., no disc in CD-ROM drive), yous get an error.

  • How exercise you copy files from one drive to some other drive?
  • How to modify drives in MS-DOS and Windows command line.

Creating a new file

Y'all can create a new file from the command line using the edit command, copy con command, or using the start command to open a file.

  • How to create a file in MS-DOS and the Windows control line.

Creating a new batch file

In the new test directory, let's create your get-go file. In virtually circumstances, you never need to create whatever file at the command line, but it is however good to understand how files are created. In this example, we are creating a batch file. A batch file is a file that ends with .bat and helps automate frequently used commands in the control line. We are calling this batch file example, and then type edit case.bat at the prompt. Every bit mentioned in the document on creating a file, if the edit command does not work, utilise the start command to open the batch file in Notepad. To perform this action, y'all type offset notepad example.bat into the prompt.

Both of the commands above open a new blank instance.bat window. In the file, blazon the three lines beneath, which articulate the screen with the cls command and run the dir command.

@echo off cls dir

After these three lines are typed into the file, save, and go out the file. If you are in the edit control, click File (or press Alt+F) and so Relieve. Later the file is saved and you are back at the control prompt, typing dir displays the "example.bat" file in the test directory.

Now, run the batch file to become a improve agreement of what a batch file does. To run the batch file, blazon example at the prompt, which executes the batch file, clears the screen, and runs the dir command.

  • Total information and additional examples on batch files.

Moving and copying a file

Now that we've created a file, let's move it into an alternate directory. To aid brand things easier, create another directory for the files. And so, blazon mkdir dir2 to create a new directory in the test directory chosen dir2. After the new directory is created, use the move command to motility the example.bat file into that directory. To practise this, type move example.bat dir2 at the prompt. If done successfully, you lot get a bulletin indicating the file was moved. You could also substitute the move command for the copy command to copy the file instead of moving it.

  • How to motility files and folders on the calculator.
  • How to copy files.

Rename a file

After the file is moved into the dir2 directory, movement into that directory with the cd command to rename the file. In the dir2 directory, use the rename control to rename the example file into an alternate proper name. Type rename example.bat kickoff.bat at the prompt to rename the file to "offset.bat." At present, when using the dir command, you see "commencement.bat" every bit the only file.

Tip

When renaming any file, make sure the file has the same file extension. If you were to rename the .bat file to a .txt file, it is no longer an executable file just a text file. Also, keep in mind that renaming the file to a unlike file extension does not convert the file. For case, if y'all renamed the file as an .MP3, it may await like an MP3 in Windows, but it'due south not going to play music.

  • How to change or rename a file, folder, or directory.

Deleting a file

Now that nosotros've had our fun with our new file, delete the file with the del command. Type del first.bat to delete the commencement.bat file. If successful, you are returned to the prompt with no errors, and the dir command shows no files in the current directory.

Tip

When deleting files, you can also use wildcards to delete multiple files at once. For example, if the directory contained several .GIF image files you could blazon del *.gif to delete all files catastrophe with the .gif file extension.

  • How to delete a file, directory, or folder.

Renaming a directory

Go back one directory to become dorsum to the test directory using the cd.. control mentioned earlier. Now, rename our dir2 directory to something else using the same rename control we used earlier. At the prompt, type rename dir2 hope to rename the directory to "hope." Afterwards this control is completed, type dir and yous see one directory called "hope."

  • How to change or rename a file, folder, or directory.

Removing a directory

While still in the test directory, remove the hope directory using the rmdir command. At the prompt, type rmdir hope to remove the hope directory.

Tip

If the directory you are trying to remove contains any files or directories, you'll receive an error. To prevent this mistake, use the /south choice. For example, if the hope directory still had the start.bat file, yous would need to blazon rmdir /due south hope at the prompt.

  • How to delete a file, directory, or folder.

Running a program

Any executable file can run from the control line by typing the name of the file. For example, if you listed files using the dir command and see a file named "myfile.exe," typing "myfile" at the control line runs that program.

  • How exercise I run a file from MS-DOS?

How to list bachelor commands

After getting a good understanding of using the command line from the steps shown above, you can move on to other available commands by typing help at the control line. Typing "help" displays a list of available commands with a brief description of each command.

Closing or exiting the control line window

After you are done with the Windows control line, you tin type go out to close the window.

In determination

At present you have a good agreement of how to navigate the command line, create directories and files, rename directories and files, and delete. As mentioned earlier, there are hundreds of other commands you tin apply at the command line. If y'all want to expand your knowledge farther, nosotros recommend looking at the options available for each control to a higher place and reviewing our commands overview page. Yous can as well use our search to find whatsoever command by the proper name of the command or by the action it performs.

berriossyle1979.blogspot.com

Source: https://www.computerhope.com/issues/chusedos.htm

0 Response to "Cmd Prompt + Command to Make Dos Look at External Commands Again"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel