Commands

In Windows, two built-in command-line interfaces allow users to execute commands, manage system settings, and automate tasks. It is important to be familiar with these utilities to fully leverage the potential of the operating system.

CMD

Known as Command Prompt, is a command-line interpreter that allows users to execute commands from a text-based interface. It supports a wide range of commands for file manipulation, system configuration, and troubleshooting.

Some of the commands that can be used through this interface are:

  • Show the name of the system

hostname

  • Show the logged-in user

whoami

  • Show manual for a command

$command /

  • Show network address settings

ipconfig
ipconfig /all    #Full configuration information

  • Show protocol statistics and current TCP/IP network connections

netstat

  • Makes a ping to a machine

ping -n $IPadress

  • Traces the route taken by the packets from your system to another host

tracert $IPadress

  • Check, modify, and assign permissions to a file or directory

icacls $filename

PowerShell

A command-line interpreter that supports a wide range of commands for automating administrative tasks, managing complex configurations, and interacting with web services or APIs. Integrates the .NET framework and offers advanced scripting capabilities.

Some of the commands for this interface are:

  • Retrieves a list of currently running processes

Get-Process

  • Lists all services on the system and their current status

Get-Service

  • Configures the execution policy, controlling the ability to run scripts

Set-ExecutionPolicy $option

  • Displays detailed help information about commands, including usage examples

Get-Help $command

  • Lists the files and directories in a specified location, similar to dir or ls in other systems

Get-ChildItem $path
  • Generate a copy of files or directories from one location to another, similar to cp in Linux

Copy-Item -Path $path -Destination $destination

  • Displays the content of a file, similar to cat in Linux

Get-Content $filepath

  • Creates a new file, directory, or other type of item

New-Item -Path $path -ItemType $type

  • Move a file or folder, similar to mv in Linux

Move-Item -Path $path -Destination $destination

  • Finds text within a file

Select-String -path $path --pattern $text

  • Show the firewall rules

Get-NetFirewallRule -all

Last updated