Question:
Does anyone have a list of commands for the command prompt and what they do?
Brent
2009-01-09 02:18:32 UTC
I'm just a curious nerd who wants to learn...
Three answers:
padge61
2009-01-09 02:36:46 UTC
I'll tell you one.

help
Mark
2009-01-12 02:19:46 UTC
At the command prompt type: help

and press enter and you will find a list of commands, but I will explain some to you:



Navigating around directories: To start off, if you would like to manipulate and run commands on files, you will have to navigate to their proper directories that they are contained in. for example to navigate to your desktop to run commands in that directory type this:



cd "%userprofile%\Desktop"



I apologize for using 'Environmental Variables' so early in this lesson but %userprofile% is a type of variable properly referred to as an 'Environmental Variable' that holds a value that (depending on your Windows OS version) could either mean 'C:\Users\{username}' or 'C:\Documents and Settings\{username}' note the {username}. The {username} means the current user who is logged on in the command prompt. So if your username is bob then %userprofile% would mean:

C:\Users\bob

or

C:\Documents and Settings\bob

Anyways, Your computer is organized into folders or directories. C: is the local disk the main drive of you computer, then it narrows down to other folders such as "Users" or "Documents and Settings" then it narrows down to a list of other folders and users. So on %userprofile%, you would put a 'backslash' \ to separate the folder names. after the backslash we went to the "Desktop" folder where your desktop is located.

this command is called 'cd' followed by the filepath of the directories you want to navigate to.



So now on your desktop let's say that you have a text documents called "abc" and you want to delete it. So first navigate to your desktop by typing:



cd "%userprofile%\Desktop"



then type:



del "abc.txt"



Note: that I put .txt after abc. This is the file extension of the file. Different types of files have different file extensions. A Text Document has a .txt extension. An executable program has a .exe extension. A type of music file could have a .wmv or .mp3 or .wav extension. The list goes on. Also note that I have surrounded the filename with quotes, this is a good practice because it makes clear to the command prompt what file you are referring to. Because it will get confused if your filename has spaces in it. Surrounding it in quotes will contain the filename if it has spaces.



After typing del "abc.txt" you will get a prompt confirming whether you want to delete it. If you don't want the prompt to show up you can specify the "Syntax" of the command.

A syntax is a suffix or extension to the command denoting how the command should be carried out. You may find an explanation of the syntax of the command by typing the command at the command prompt followed by '/?' for example:



del /?



then you would get a list of syntax for the command. So here's a syntaxed command for del:



del /f /q "abc.txt"



As you can see the /f would force the deletion of read-only files and the /q means "Quite-mode", it will not prompt you for deletion of the file.



So that's an explanation of deleting a file, but what if you want to rename the file?

To rename a file use the "ren" command"

So on your desktop you have abc.txt and you want to rename it to def.txt:



ren "abc.txt" "def.txt"



So that would rename abc.txt to def.txt, it simply works like this:



ren "{original_filename}" "{new_filename}"



To copy a file use the "copy" command. The following will copy "abc.txt" from your desktop to your documents:



copy "abc.txt" "%userprofile%\My Documents"



Remember you must be in the proper navigated directory for it to work in this case it's cd "%userprofile%\Desktop". otherwise you will have to put the FULL filename:



copy %userprofile%\Desktop\abc.txt %userprofile%\My Documents



So far I have explained how to delete, rename, and copy a file. there are many many more commands that you can use that I know about. Please feel free to ask me any question on this and I will gladly respond. There are even ways to run commands at command prompt automatically by creating a "batch file" that runs every command that you have listed in the file line by line which I can explain to you if you ask. Thank you.
Jen-A
2009-01-09 10:48:59 UTC
take a look here.

http://en.wikipedia.org/wiki/List_of_DOS_commands


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...