Working with the Windows Command Prompt

From EDukeWiki
Jump to: navigation, search


Opening A Command Prompt Window

There is a convenient way to open command prompt windows by right-clicking on any folder and selecting the relevant menu choice.

Windows Vista, 7, and higher

Hold Shift when you right-click on a folder and the option to open a command prompt window will appear.

Windows XP and lower

This registry patch will add a right-click option: File:Cmdhere.zip

Expand the Screen Buffer

  1. Open a command prompt.
  2. Right-click on the title bar.
  3. Select Properties.
  4. Navigate to the Layout tab.
  5. Increase the Screen Buffer dimensions as desired.

Win7 cmd Layout.png

How to Copy and Paste Text

Source: [1]

Enabling QuickEdit Mode

To copy and paste text easily in the command prompt, first we must enable QuickEdit mode:

  1. Open a command prompt.
  2. Right-click on the title bar.
  3. Select Properties.
  4. Make sure the QuickEdit Mode checkbox is checked.
  5. Click OK.
    1. If you are presented with an option, select Save Properties for future windows with same title if you want to keep this change forever, or select Apply Properties for current window only if you only want to enable QuickEdit for this session.
    2. Click OK.

Win7 cmd Options.png

Once you have QuickEdit Mode enabled, the process is simple:

Copying

  1. Click and drag to highlight the desired text in the console.
  2. Press Enter in the console to copy this text into the clipboard.

Pasting

  1. Copy the desired text into the clipboard at its source.
  2. Right-click into the console to paste the text.

Configuring PATH

PATH is an environment variable that holds a list of directories in which the command prompt will search for exe files when a command is issued. For example, C:\Windows\system32\ is part of PATH by default, which allows you to type cmd instead of C:\Windows\System32\cmd.exe

Persistent

Open the Properties dialog of Computer or This PC (by right-clicking and selecting "Properties", or by holding ALT and double-clicking), select "Advanced system settings" in the top-left, and navigate to the Advanced tab. Alternatively, press [WinKey]+[R] and issue the command control sysdm.cpl,,3. Once on the Advanced tab, press the Environment Variables... button.

Win7 System Properties.png Win7 Environment Variables.png

From there you can edit the variable named Path (either system-wide, or limited to your user account). It is formatted as a semicolon-delimited string of text. For example, C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\, etc. The closer a path to the start of the list, the higher its precedence.

Temporary

If you would like to adjust the PATH of just the current command prompt window, you can run this command:

set PATH=C:\Path\To\Folder;%PATH%

If you find yourself often making the same temporary PATH changes, you may want to save their command invocations in a batch file that is itself located within persistent PATH.