Windows 10

Windows 10 FAQ

 

Windows 10 Commands

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

Windows 10 includes the powerful PowerShell which makes use of the features of 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 PowerShell Docs for more information. Windows 10 comes with Powershell v5. If you want to run an older version, enter Powershell.exe -version number e.g. 3.0 or 4.0 (you need .NET Framework 2.0 for v2.0).

You can access it via Windows+X then enter PowerShell or Ctrl+R and enter powershell.exe.
If you run PowerShell_ISE.exe instead, you can use its build in text editor for developing scripts.

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 10?

Powershell has a large number of commands available. Here are a few common ones:

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
Read-Host n/a Read line of input from console
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
Write-Host n.a Display text to host unaltered (does not use PS Engine)
Write-Error n/a Displays text to error stream.

 

3. Where can I add more commands to my Windows 10 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 Powershell window?

Open a PowerShell 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 prompt text?

By default, the command prompt is PS and the current path followed by an arrow e.g. PS C:\Windows>. The prompt is set in the user's powershell profile, e.g. PSedit $PROFILE and create a prompt function with the customization output strings. See Norlunn blog for exmples.

function global:prompt
{
     Write-Output "Powershell "
     Return "> "
}

6. Where can I find other command line tools?

If you want an old BASIC interpreter try VBScript, GWBasic (for full screen support use DOSBox), QBasic or the more recent Xojo (Real Basic).
For more advanced scripting languages try Perl or Python.
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.
Microsoft's Sysinternals tools.

7. Can I still run the old Command Prompt?

Windows 10 still has the old command prompt. You can access it via Start, Windows, Accessories, Command Prompt, Windows+X then Command Prompt or Ctrl+R and enter cmd.exe.
To enable Command Prompt rather than Powershell from taskbar, go to Settings, Personalisation, Taskbar and disable 'Replace Command Prompt with Windows Powershell' option.

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

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.

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.

If you have the latest update for Windows 10 installed, you can enable the Bash shell for Windows SubSystem for Linux:

a) Open Control Panel.
b) Open Programs and Features.
c) Select Turn Windows Features on or off.
d) Enable 'Windows Subsystem for Linux'.
e) Open Settings, Update and Security and enable 'Developer mode'.
f) Open Windows Store,then search for Linux.
g) Select the Linux to install e.g. Kali, Debian, SUSE (all free).
h) Click Get to download the linux distribution e.g. 75 MB for Debian.
i) Click Launch to install it (or see 'Debian' in the Windows start menu).
j) Enter a UNIX username and password.
k) Bash shell is now available.

Command Description
ls List directory
pwd Print working directory
cd Change directory
help List commands and format.
NB: man is not available.
nano Text editor
vi VIM text editor
echo Display text
cat Display contents of file
cp Copy file(s)
rm Remove file
mv Rename or move file
exit Close shell

9. Can I try the new Windows Terminal?

Yes, it is currently in preview, but you can download it via Microsoft Store. It will allow to run the PowerShell, Command Prompt and Azure Command Shell from one Terminal window.

Windows Terminal

 

New Features