Dosprompt - Info From Sembee LTD.: UK MS Exchange Consultants
Dosprompt - Info From Sembee LTD.: UK MS Exchange Consultants
info MS Exchange Resources Knowledge Base search Login Scripts Recovery of MS Office content UK ISP Status Pages Automatic Updates Client Sembee Blog
Home Getting Starting Guide Network Diagnostics NETSTAT MX Record Lookup Amazon Store
Many of the troubleshooting techniques you will find on the internet make use of the DOS or Command Prompt. This is how computers used to work before the mouse became common. You have to type in your commands. This site will give you a quick overview of how the command prompt works. Initially it starts with showing you how to move around your file system. When it comes to running more advanced commands, this basic information will help because different commands need to be run from different directories. This information was formally on amset.info, but has now been moved to its own separate domain. You may have been redirected here from amset.info. Throughout this page you will see this referred to as a command prompt. DOS Prompt and Command Prompt are the same thing.
You should have a Command Prompt open when reading this page so that you can try the commands. Unless stated, you will not damage your data by just moving around your folders.
Command Prompt on Windows Vista, Windows 7 and Windows 2008 On Windows Vista and Windows 7, a standard Command Prompt may not allow you to do everything that you need to. In that case you will need to use an elevated command prompt. The best way to start an elevated command prompt is to RIGHT click on the shortcut and choose Run As Administrator. How to tell if the command prompt is elevated If the prompt is elevated, then the initial path will be C:\Windows\System32. The title bar will also say "Administrator: Command Prompt". If the prompt is not elevated then by default it will start in C:\Users\Username (where username is the username of the account in use) and the title bar will just say "Command Prompt". The example above was configured to start in C:\ .
CLS If you have lots of text in your Command Prompt window, this command will clear it. However history of previous commands typed in that session will be maintained.
dir /s *.doc will list all files that end in .doc (Word files). CD - Change Directory The CD command is very simple to use. All commands are relative to the directory that you are in. Therefore, using the example output of a "dir" that is shown above, if you want to change to the "Windows" directory, you would type CD Windows If you want to change to the "system" directory (which is a sub directory of "windows"), you would enter CD System However if you knew that you wanted to change to the system directory immediately, you could type this command instead: CD Windows\System However if you were already deep in another directory (for example c:\ documents and settings \username\ local settings) and then wanted to move directly to windows\system then you can do that by putting in an initial backwards slash: CD \Windows\System This tells the command to go to the root of the drive, then to the directory Windows and system. Moving Back Up You can also move back up the tree, instead of down. If you want to just return to the root of the drive (C:\) you would just type cd \ or cd\ If you wanted to just go back one level (to use the earlier example, you were in c:\windows\system and you wanted to be in c:\windows) you would just type: cd.. Alternatively, if you want to access a totally different directory, for example "Program Files" you could type cd program files or cd "program files" When typing directories to change to, if the directory name is unique, then you can use wild cards. For example cd program*
Directory Entry Shortcut: : If you are on Windows 2000 or XP and you have a Windows Explorer screen open at the location that you want to run a Command Prompt command you could open the Command Prompt and typing a long series of directories or CD commands. Instead, just type CD and then a space, then drag and drop the directory you want to work in to the Command Prompt window. The full path to the directory will be entered, ready for you to press enter.
Change Drive
If you want to run a command against a directory on another drive, such as the D drive, then you need to change to that drive, This is done simply by entering the drive letter and a colon: d: On Windows Vista and higher you can also combine the drive letter change and directory by using the full path: cd d:\downloads On Windows XP and older, you can still enter the above command, but will then need to do d: . When you do, you will find that you are in the directory where you did the CD command to.
More Commands
These commands can change file names, create directories etc, so should be used with caution. File Renaming You can rename files in a command prompt. rename something.txt someone.txt would rename the file something.txt to someone.txt Directory Creation You can create directories from the command prompt: mkdir something would create a directory called "something". If you want a directory with a name that has a space in it, such as "My Files" you need include the command in " ": mkdir "my files" This ensures that the directory is created with the space. Without the space you will get a new directory called "my" and an error message.
This technique can save a lot of time if you need to change to a directory with a long name. It will also let you enter hidden folders that do not appear with dir without having to remember the correct name. Repeat a Command If you want to repeat a command that you have just run, or adjust something in the last command, press the "Up" cursor key to bring it back. You can then adjust it and press enter. Useful if you are trying to work out what switches and options you can use to achieve a certain result. History is not maintained across sessions, but is maintained if you use CLS to clear the screen.
Deleting Files
Finally - remember that if you delete a file within a Command Prompt session it does not go in to the recycle bin. It will be deleted immediately.
Network Diagnostics One of the most common uses for the command prompt is to do network diagnostics. You can find out more information about using the command prompt for this on our network diagnostics page. Running scripts remotely Using the Sysinternals tool PSEXEC it is possible to run commands on remote systems. This has been used to great effect to work with Windows Automatic Updates and has been described in some depth on that site here. Netstat - what Application is using what port A built in command line tool is netstat - it can show you a lot of information about what application is using which TCP port, which is useful when looking for problems with network aware applications. The command combinations for netstat are described here.
Further Reading
You can purchase books which cover the Command Prompt in more depth from our Amazon Store.
More Content from Sembee Ltd. Resources on exchange.sembee.info Microsoft Exchange 2003 Microsoft Exchange 2007 Microsoft Exchange 2010 Microsoft Outlook Exchange Networking Tasks Amazon Store Other Sites Sembee Ltd.
Command Prompt Getting Started Microsoft Exchange Consultancy Guide Login Scripts Director's Blog MS Exchange Resources Knowledge Base search Recovery of MS Office content from Temp Files Troubleshoot the Automatic Updates Client UK ISP Status Pages
Sembee Ltd. 1998 - 2011. Reproduction of any content on this web site is prohibited without express written consent. Use of this web site is subject to our terms and conditions. All trademarks and registered trademarks are property of their respective owners. This site is not endorsed or recommended by any company or organisation mentioned within and is to provide guidance only and as such we cannot be held responsible for any consequences of following the advice given. Sembee Ltd. is registered in England and Wales at 33 Scrivens Mead, Thatcham, Berkshire, RG19 4FQ. Registered company number: 4704428. VAT Number GB 904 5603 43.