The Command Prompt Lives, a Beginner’s Guide from a Beginner

Most people will use Powershell, the *nix-like command interpreter brought to Windows. I am “old school”. I remember MS-DOS when I was young, I always wanted to learn it better. I read an article on the Windows Blog that mentioned that the Command Prompt still lives and it encouraged me to re-delve into it. Having used the Command Prompt for a bit I can tell that it is decent.

A command interpreter and its tools can be easier to use than the File Explorer for certain tasks. For example: with a large number of file management tasks; to recycle all photos: del *.jpg; and move or rename a file: move name.txt dir\subdir\rename.txt.

Most commands that get used are described with the help command. I made an organized list below which is mostly a rehash of the help command. help command will provide ore details.

  cd/chdir  —directory change to, just "cd" will display path
  dir       —directory content list
  popd      —directory location return to
  pushd     —directory location change to, remember old
  tree      —directory hierarchal view
  copy      —dir/file copy
  del/erase —dir/file to recycle bin
  md/mkdir  —directory make, has recursive ability "c:\a\b\…"
  move      —dir/file move or rename
  rd/rmdir  —directory remove (erases), `/s` for recursive
  other     —attrib cipher compact expand icacls makecab recover en/ame replace robocopy xcopy
  diskpart  —disk partition and format tool: efficient yet use with attention
  other     —chkdsk convert defrag fdisk format label subst
  exit      —exit Command Prompt or script
  taskkill  —terminate task or application
  other     —powercfg runas sc shutdown start tasklist
  assoc ftype reg regini regsvr32
  doskey    —macros (aliases in Linux) define, history show
  path/set  —per term environmental-varible editing/addition, type "Environmental Variables" in Start Menu to keep
  prompt    —Command Prompt elements define
  other     —date mode setx time title ver whoami
  comp      —like diff!?
  find      —find text string, in file or piped
  more      —display output one screen at a time "type file|more"
  type      —display contents of text file(s)
  other     —fc findstr print
  choice    —choice prompt?!
  cscript   —scripting engine? used for Visual Basic
  echo      —display message
  for       —loop defined inputs to command
  if        —conditional processor
  rem       —remark (that is, a note line)
  arp getmac hostname ipconfig net netsh netstat nslookup ping
  driverquery msiexec sfc systeminfo w32tm WBAdmin winsat
  bcdedit bootcfg
  clip      —output of command place in clipboard
  cls       —clear screen

other tips

  • explorer . (or dir\subdir) opens file explorer
  • tab-completion is available for files and directories (e.g. cd d[tab] will loop through directories starting with d)
  • esc clears line, f7 displays command history, f8 search command history
  • doskey can add macros (Linux “aliases”), more can be read on this post
  • I created a Command Prompt shortcut for administrative use; I like to make my admin Command Prompt use different foreground and background colors to consistently remind me to be heedful: Start Menu → type Command Prompt → right-click and Open file location → Command Prompt shortcut copy, paste, rename “Command Prompt (Admin)” → right-click “Properties” edit shortcut command to add option: %windir%\system32\cmd.exe /k "color 74 & echo Administrator" → and then “Advanced” button to choose Administrator.
  • Batch-files are used for task scripting. Windows Batch Scripting seems to cover it alright.
  • piping (|), redirection (>), conditionals && and || are available; a few details can be found here
  • I created a white theme to use with the Command Prompt, see image on right.
  • My posticon I converted into a white icon. For anyone who would like it it can be downloaded here.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s