Windows

Windows 8.1 FAQ


Windows 8.1 Commands

1. How do I type in commands rather than use Explorer?

Windows 8 comes with a command prompt. You can access it by pressing Ctrl+X and select Command Prompt. Alternatively, you can access it via Ctrl+R and enter cmd.exe.

command

The current directory is displayed followed by a flashing underline cursor. To exit this window, type exit or click on the X on top right of the window.

2. What commands are available to use with Windows 8.1?

Many of the commands are similar to the ones from the old MS-DOS days. Commands can be run from the current directory or those listed in the command path. The command path can be viewed by typing Path and can be edited via the System Control Panel, Advanced, Environmental Variables. Most commands are available in the C:\Windows\System32 folder. To view the parameters of the command you can type either Help <command> or <command> /? (slash, question mark). Commands can be combined using the pipe (|) character e.g. Type file | More.

File System Commands Purpose
append <dir> Add directory to data path when opening files
attrib <file> <attribs> Set or display attribute flags of file(s)
cd <directory> Change directory. To change drive just enter name of drive letter followed by a colon e.g. C:
copy <source> <dest> Copy one or more files (the ? and * wildcards can be used to select files)
del <files> Delete one or more files
erase <files> Erases one or more files
md <directory> Make or create a directory
rd <directory> Remove or delete a directory
ren <orig> <new> Rename file(s)
move <source> <dest> Move file(s) to another folder or drive
type <file> Display contents of a text file
more < file Display contents of a file a screen at a time
edit <file> Change contents of a file
find "string" <file(s)> Search for string in a file
comp <file1> <file2> Compare two files
compact <file> Compact or compress a file
cipher Set or display encryption settings for folders
chkdsk Check disk for errors
convert Convert filesystem to another filesystem e.g. NTFS
defrag Defragment a filesystem
diskpart Disk Partitioning program
edlin <file> Line editor (use ? for help)
expand <file> Expands a compressed file
takeown Take ownership of files or folders
   
Other Commands Purpose
mode Settings for serial and parallel ports in DOS mode
print <file> Print file to LPT1 or other device
at Set up scheduled tasks
arp Settings for Address Resolution protocol
bootcfg Set or display boot configuration (boot.ini)
cacls Set or display NTFS permissions
chcp <n> Change code page
cmd Open a command window (see above)
convlog Convert IIS log files
cscript <file> Run a VB or other script
debug Debug programs
diskperf Enable or disable disk performance counters
doskey DOS command history utility
driverquery Display installed drivers
eventcreate Utility to create events in the event log
eventtriggers Utility to create event triggers
exe2bin Converts executable files to binary format
extract /c <file> Extract files from a cabinet (CAB) file
control <cpl file> Load a control panel
dxdiag DirectX Diagnostics
sfc System File Check (check for missing or corrupt system files)
bcdedit Change boot configuration
bitsadmin BITS (Background intelligent transfer service) Administration
cmdkey Administers stored credentials
choice Choose between different options
dvdplay Play a DVD using Windows Media Player
ftp File Transfer protocol
getmac Get machine's physical address for network card
hostname Display PC's hostname
mountvol Mount volumes
openfiles Displays or disconnects open files
recimg Recovery image settings
regantc Windows Recovery environment
robocopy Robust file copy
rundll32 Run functions from within dynamic link libraries (DLLs)
syskey Secure user accounts with more encryption
sc Service Control manager
shutdown Shutdown, restart or logout from PC
taskkill Kill tasks
UnattendedJoin Unattended join to a domain
PnPUtil Plug and Play Utility (install drivers)
RpcPing Remote Procedure Call ping tool
powershell Load powershell

3. Where can I add more commands to my Windows 8.1 system?

You can add tools from the Sysinternals tools to manage files and folders, processes, security, networking and system information.

4. How do I change the colours for the command prompt?

Open a command window, select the top left of the window for a pop up menu to appear and select Properties. Select Screen text and select a colour (green is a popular colour), then select Screen Background and select another colour.

5. How do I change the command prompt text?

By default, the command prompt is the current path followed by an arrow e.g. C:\Windows> which is set by the command prompt $P$G. You can change it to a Unix type prompt using Prompt $$ or Prompt $P$G or something more exotic like Prompt $D$T$G which display date and time. For other options type Prompt /?.

6. Where can I find other command line tools?

If you want an old BASIC interpreter try GWBasic, or QBasic.
For a full search utility try unix's Grep for Windows.
For counting words, lines and sentences try WC for Windows.
For displaying the end part of file, try Tail for Windows.

7. Is there a more advanced shell for Windows?

Yes, Windows 8 includes new a shell called Powershell which uses the .NET Framework APIs to provide powerful commands to manipulate everything from disks, files, folders, user and group accounts, services, and so on. Commands usually start with Get-, Set-, Add-, Remove-, Move- and so on. Additional applications can extend the Powershell with their own commands such as Active Directory, Hyper-V, ServerManager, Exchange, SQL, Sharepoint, Lync and so on. See Technet for more information. Windows 8 comes with Powershell v3, Windows 8.1 comes with Powershell v4. If you want to run an older version, enter Powershell.exe -version number.

Command Alias / Other Purpose
Alias n/a Display or set aliases
Compare-Object Compare, diff Compare two objects such as files, and display differences
Copy-Item Copy, Cp Copy files and directorues
Get-Content Type Display contents of a file to screen
Get-Help Help, Man Help on commands
Get-History History Display history of commands entered
Get-ChildItem Dir, Ls Display files and folders
Move-Item Move, Mv Move files or directories to another location
New-Item NI, Md Create new files or directories
Out-Printer Print Print text to default or selected printer
Powershell_ISE n/a Powershell editor
Remove-Item Del, Rd Delete files and directories
Rename-Item Ren Rename files or directories to a different name
Select-String SLS Select or find a string from any given input
Set-ItemProperty SP Change properties of a file or directory
Set-Location CD Change directory or drive
Write-Output Echo Display text on Screen

 

8. Can I run a Bash shell on Windows?

Yes, you can download Cygwin for Windows, which includes bash shell, tools and languages you find on Linux systems.
Cygwin also includes XLaunch which allows you to run X Windows compatible programs e.g. xedit, xterm, xcalc, xeyes etc.
Another alternative is XMing.

New Features