Thursday 6 August 2015

50 most useful Command Prompt commands. Part 2

50 most useful Command Prompt commands. Part 2

This issue, Jane Hoskyn reveals 10 ways to organise files and folders using your PC's powerful hidden tool

11 Command your Desktop


The Command Prompt’s default location is C:\Users\your name, so any commands you type apply to that directory only. To work in a different directory, you need to move the prompt to that directory.

For example, if you want to use the Command Prompt to organise files and folders on your Desktop, move the prompt to the Desktop by typing cd (‘change directory’), followed by a space, followed by desktop. When you press Enter, the prompt should be at C:\Users\ your name Desktop.


12 Create a folder


The command ‘md’ stands for ‘make directory’ and creates a new directory (folder) in the prompt’s current location - your Desktop, for example.

Type md followed by a space, type a name for your new folder and then press Enter. If the name is more than one word, put it in quote marks. For example, to create a folder called ‘new folder’, type md “new folder”.

When you press Enter, nothing will happen in the Command Prompt. You’ll just get a new prompt. You can either go to the Desktop (or wherever you placed it) to check the folder has been created, or type dir and press Enter to see a list of folders contained in the current directory - including your new folder, along with the date and time you created it.

13 Delete a folder


You can use the ‘rd’ (‘remove directory’) command to get rid of a folder. Try it out on your newly created Desktop folder. With the prompt on the Desktop, type rd, then space, then the name of the folder you created, and then press Enter to delete the folder entirely.

14 Delete a file


This time the command is what you’d expect - ‘del’. To instantly delete a file called ‘ca.txt’, for example, type del ca.txt and press Enter. Again, you can only apply the command to the directory you’re in, so move the prompt to the relevant location first.

15 Move a file


The ‘move’ command is simplest if you're moving a file from the current directory to a folder in the same directory. For example, to move the ‘ca.txt’ file from your Desktop to a folder on your Desktop called ‘myfiles’, start with the prompt at C:\Users\your name\Desktop, type move ca.txt myfiles, then press Enter.

16 Copy a file


As above, but type copy instead of move.

17 Move or copy to a different directory


To move or copy a file to a folder in a different directory, use the ‘move’ or ‘copy’ command as above but type the full path of the destination folder.

18 Rename a file


Move the prompt to the directory containing the file, then type rename, then space, then the file name (with extension) in quote marks, then space, then the new name, and then press Enter. For example, rename “ca.txt” “new name.txt”.

19 Label a folder


Use the ‘label’ command to rename an entire directory. For example, label e: Photo. We recommend saving this command for partitions and external drives rather than your C: drive.

20 Organise multiple files


The asterisk (*) is a wildcard command that lets you apply an instruction to lots of files or folders at the same time. For example, to delete all text files in the current directory, type del *.txt and then press Enter. There’s no warning (‘Are you sure you want to delete...?’) so use the wildcard and the ‘del’ command together with extreme caution!