Showing posts with label Command Prompt. Show all posts
Showing posts with label Command Prompt. Show all posts

By Your Command: A Rough Guide to the Command Prompt, Part 2

In a previous post I explained how to navigate to different drives and folders using Command Prompt. I also showed how to list the contents of the current folder using the dir command. We will now look a little closer at this command.

In the tutorial, I suggested typing the following command dir /a-d /b > filelist.txt. We shall not worry about the > filelist.txt part for now, but rather look at the anatomy of the dir command itself to serve as an example of how Command Prompt works.

Following the dir command there are two switches: /a-d and /b. These switches alter the way in which the command works. In this case they adjust what folder contents is listed and how it is presented: /a-d stops the dir command from listing folders; /b prevents the command from showing the extra information you see if you just type dir and hit Return.

You can list all the switches associated with dir by entering dir /? in the Command Prompt. The /? switch provides help for any command it follows. In the case of dir it returns something like this:

This may be a little forbidding for the novice; so, I will give another example of switches in action. If you wanted to list all the folders (or directories as they are known in Command Prompt) at the top level of your D:/ drive you would enter -

dir d: /ad
[Note that switches are not case sensitive]

If you wanted to also list all the sub-folders, you would enter -

dir d: /ad /s

You may notice how all the information scrolls past really quickly. To pause after each page of information you can use the /p switch. Thus, the command becomes -

dir d: /ad /s /p

To list all the mp3 files on drive D: pausing after each page use the following command -

dir d:\*.mp3 /s /p

The asterisk is a wildcard. In other words. it means 'any combination of letters'. So if you wanted to list all the mp3 files with the word 'Beatles' in the filename you would use -

dir d:\*beatles*.mp3 /s /p

The dir command is a good way of having a play with the command prompt safe in the knowledge that you will do no harm to your files. If you have any questions about this command feel free to leave a comment and I will do my best to address them. More commands next time.







By Your Command: A Rough Guide to the Command Prompt, Part 1

Before the rise of graphical user interfaces (GUIs) the main method of controlling computers was through text based operating systems such as MS-DOS. You can still use these old DOS commands using a facility called Command Prompt that is available in all forms of Windows. In this first part of this rough guide, we will look at how to open the Command Prompt and we will explore some of its features.

You can run the Command Prompt from the Start menu. You will find it in the 'Accessories' folder. Alternatively you can open it by typing cmd in the Run box, which you can either open from the Start menu or by holding down the Windows key and pressing R.

In Windows Vista and 7, certain commands are unavailable unless you run the Command Prompt as an administrator. To do so you can right-click on the icon in the Start menu and select 'Run as administrator' from the menu. You can also use the Run box: type in cmd as before and then hold down the Ctrl and Shift keys and press Enter. You may be required to supply an administrator password at that point.

The Command Prompt will look something like this:


Click on the icon to the right of the title bar [circled in red] to open a menu. There are items in this menu to enable you to edit commands and change the look and feel of the Command Prompt. The usual copy and paste keyboard commands do not work in the Command Prompt so you will have to use the edit menu to do so. This menu offers a variety of other features including 'Find'.

To change the appearance of the Command Prompt, you can either click on 'Properties', which will alter the look and feel of the current session and, should you wish, other sessions started the same way, or you can click on 'Defaults' to change the appearance any Command Prompt you open from now on (Note: this does not over-ride changes made using 'Properties'). Either way, a box will open with a different title and a few different options depending on whether you clicked 'Properties' or 'Defaults'.

'Options' tab


On the 'Options' tab you can change the cursor size from a thin flashing line to a flashing box. The 'Command History' settings alter the way that the Command Prompt remembers previous commands, something that we will explore in a later post. The 'Display Options' enable you to set the Command Prompt to appear full screen if you so desire.

In the 'Edit options' you can activate 'Quick edit mode', which lets you use the mouse to select text. 'Insert mode' functions in the same way as the Insert key, allowing you to either insert what you type or overwrite any text to the right of the cursor. On the 'Defaults' options there is an extra setting: 'AutoComplete'. This enables you to use the Tab key to complete folder and file names.


'Font' tab


You can change the size and style of the displayed font here.


'Layout' tab


You can alter the appearance of the Command Prompt window on this tab. The 'Screen buffer size' options affect the width and number of lines, but do not change the visible screen size. Consequently you may have to use the scroll-bars to see all the text. These are particularly useful if you change the font size. The size of the window itself can be changed using the 'Window Size' settings - no surprise there. You can also decide where the Command Prompt appears on the screen using the 'Window position' settings.


'Colors' tab


If you wish to have yellow text appear on a dark blue background, then this is where you can make it happen. You can also set the colour of the Popup text and background. We will look at some of these popups in later posts.

For those of you eager to impress your friends with your 'old school' computing skills, check out a previous post in which I looked at changing the current directory and listing its contents.

Next time I will look at a few simple commands.







By Your Command: File and Folder paths the easy way

When using the Command Prompt you can avoid typing the whole path for files and folders by dragging and dropping them onto the Command Prompt window. This video shows this time-saving feature in action.



Please note that this function does not work with all icons such as the My Documents icon on the desktop.



More Command Prompt tips soon.






 
Copyright Computer Magazines | Magazines Computer | Powered by BloggerTheme by Donkrax