Windows Guide

Using the Command Line


Windows has a cmd.exe a command prompt. Also, you run the more powerful powershell.exe to load the new Powershell command prompt.

To create a simple bootable floppy, insert a floppy disk in A: drive, open My Computer, right click A: icon and select Format, there is a option to create a MS-DOS startup disk.

To create a bootable USB or DVD disk and you use a BIOS (Basic Input Output System) ROM, then you use the Windows Media Creation utility.
If your PC has a UEFI ROM then you can use the Rufus boot utility.

Unlike MS-DOS or Windows 9x, Windows does not run a Config.sys or Autoexec.bat on startup. Instead you can run a script when loading the command prompt from a shortcut e.g.
C:\Windows\System32\Cmd.exe /K: c:\Scripts\Auto.bat which will load the command prompt and run the auto.bat script and leave the window open. For Powershell, you can run
Powershell -Command command , or -File script-file or Powershell_ISE -File script-file.

Environment variables are defined in the System Control Panel (see the Advanced tab, Environment Variables button) which defines the PATH, TEMP, and TMP variables among others.
You can configure temporary variables using the SET command, these are lost when the command window closes.

The command prompt supports most common commands such as Cd, Copy, Del, Erase, Doskey, Dir, Move, Tree, Xcopy, Edit, Exit, Sort, Subst, Attrib, If, Help, Share, Choice, Net and others.
To view the syntax of a command enter command /? or Get-Help command.

The PowerShell has a wide range of command including Set-Location, Copy-Item, Remove-Item, Move-Item, Get-Item, Get-Process, Get-Help, Get-Event, Get-Date, Set-Date using its verb-noun formatted commands.

If a old program cannot be run in Windows command prompt, then you can use the powerful DosBox tool which will completely virtualise the DOS environment for you.

In more recent version of Windows, you can use the new Windows Terminal which updates the old command prompt.

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)
xcopy <source> <dest> Extra copy of file and/or subdirectories to another folder.
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
schtasks 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)
cscript <file> Run a VB or other script
diskperf Enable or disable disk performance counters
dism Deployment Image and Servicing Management tool for images and disks.
doskey DOS command history utility
driverquery Display installed drivers
eventcreate Utility to create events in the event log
exe2bin Converts executable files to binary format
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
pnputil Plug'n'Play utility to install, uninstall and manage drivers.
recimg Recovery image settings
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
PnPUtil Plug and Play Utility (install drivers)
RpcPing Remote Procedure Call ping tool
powershell Load powershell

Task Manager