Windows Command Line

From NSIS Wiki
Jump to navigationJump to search
Author: sag47 (talk, contrib)


This is a quick tutorial for how to use the Windows Command Line. It is also commonly referred to as the Command Prompt.


How to access it?

1. Click on Windows Start menu

2. Click "Run Command..." (Vista Users: Use the shortcut [Windows Key]+R)

3. Type "cmd" without quotations


Terminology

A directory is a synonym for folder.

General Commands/Features

Example:

command - description

Command List:

cd - Enter a directory
cd .. - Leave a directory
del - Remove a file or empty directory
help - Display a detailed list of commands and short descriptions
mkdir - Create a directory

You can also view a detailed description of a command by simply typing

command/?

Just replace command with the command of your choice such as "del/?"


Windows environment variables

Example:

variable - default Windows 2000/XP path
         - default Windows Vista path

If only one path is provided then it is the same for all Windows 2000/XP/Vista

{whatever} is a variable that changes with each system the command is run on

Variable List (not all variables listed):

%ALLUSERSPROFILE% - C:\Documents and Settings\All Users
                  - C:\ProgramData
%APPDATA% - C:\Documents and Settings\{username}\Application Data
          - C:\Users\{username}\AppData\Roaming
%COMPUTERNAME% - {Computer Name}
%COMSPEC% - C:\Windows\system32\cmd.exe
%HOMEDRIVE% - C:
%HOMEPATH% - \Documents and Settings\{username}
           - \Users\{username}
%PATH% - C:\Windows\System32\;C:\Windows\;C:\Windows\System32\Wbem
%PATHEXT% - .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.WSF;.WSH
          - .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
%PROGRAMFILES% - C:\Program Files
%PROMPT% - $P$G
%SYSTEMDRIVE% - C:
%SYSTEMROOT% - C:\Windows
%TEMP% and %TMP% - C:\DOCUME~1\{username}\LOCALS~1\Temp
                 - C:\Users\{username}\AppData\Local\Temp
%USERNAME% - {username}
%USERPROFILE% - C:\Documents and Settings\{username}
              - C:\Users\{username}
%WINDIR% - C:\Windows