reg load
Load saved sub keys into a different sub key in the registry. This is intended for troubleshooting and temporary keys. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-load.
- Load a backup file into the specified key:
reg load {{key_name}} {{path\to\file}}
shutdown
A tool for shutting down, restarting or logging off a machine. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/shutdown.
-
Shutdown the current machine:
shutdown /s
-
Shutdown the current machine force-closing all apps:
shutdown /s /f
-
Restart the current machine immediately:
shutdown /r /t 0
-
Hibernate the current machine:
shutdown /h
-
Log off the current machine:
shutdown /l
-
Specify a timeout in seconds to wait before shutting down:
shutdown /s /t {{8}}
-
Abort a shutdown sequence whose timeout is yet to expire:
shutdown /a
-
Shutdown a remote machine:
shutdown /m {{\\hostname}}
choice
Prompt user to select a choice and return the selected choice index. More information: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/choice.
-
Prompt the current user to select a
Y
orN
choice:
choice
-
Prompt the current user to select a [c]hoice from a specific set:
choice /c {{AB}}
-
Prompt the current user to select a choice with a specific [m]essage:
choice /m "{{message}}"
-
Prompt the current user to select a [c]ase-[s]ensitive [c]hoice from a specific set:
choice /cs /c {{Ab}}
-
Prompt the current user to select a choice and prefer the [d]efault choice in a specific [t]ime:
choice /t {{5}} /d {{N}}
-
Display help:
choice /?
finger
Return information about one or more users on a specified system. The remote system must be running the Finger service. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/finger.
-
Display information about a specific user:
finger {{user}}@{{host}}
-
Display information about all users on the specified host:
finger @{{host}}
-
Display information in a longer format:
finger {{user}}@{{host}} -l
-
Display help information:
finger /?
tskill
Ends a process running in a session on a Remote Desktop Session Host. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/tskill.
-
Terminate a process by its process identifier:
tskill {{process_id}}
-
Terminate a process by its name:
tskill {{process_name}}
logoff
Terminate a login session. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/logoff.
-
Terminate the current session:
logoff
-
Terminate a session by its name or id:
logoff {{session_name|session_id}}
-
Terminate a session on a specific server connected through RDP:
logoff {{session_name|session_id}} /server:{{servername}}
nfsstat
Display or reset the number of calls made to the NFS server. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/nfsstat.
-
Display the recorded number of calls made to the NFS server:
nfsstat
-
Reset the recorded number of calls made to the NFS server:
nfsstat -z
Invoke-Item
Open files in their respective default programs. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/invoke-item.
-
Open a file in its default program:
Invoke-Item -Path {{path\to\file}}
-
Open all files inside a directory:
Invoke-Item -Path {{path\to\directory}}\*
-
Open all PNGs inside a directory:
Invoke-Item -Path {{path\to\directory}}\*.png
-
Open all files inside a directory containing a specific keyword:
Invoke-Item -Path {{path\to\directory}}\* -Include {{*keyword*}}
-
Open all files inside a directory except those containing a specific keyword:
Invoke-Item -Path {{path\to\directory}}\* -Exclude {{*keyword*}}
-
Perform a dry run to determine which files will be opened inside a directory through
Invoke-Item
:
Invoke-Item -Path {{path\to\directory}}\* -WhatIf
cinst
This command is an alias of choco install
.
More information: https://docs.chocolatey.org/en-us/choco/commands/install.
- View documentation for the original command:
tldr choco install
reg add
Add new keys and their values to the registry. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-add.
-
Add a new registry key:
reg add {{key_name}}
-
Add a new value under a specific key:
reg add {{key_name}} /v {{value}}
-
Add a new value with specific data:
reg add {{key_name}} /d {{data}}
-
Add a new value to a key with a specific data type:
reg add {{key_name}} /t {{type}}
-
Forcefully overwrite the existing registry value without a prompt:
reg add {{key_name}} /f
choco source
Manage sources for packages with Chocolatey. More information: https://chocolatey.org/docs/commands-source.
-
List currently available sources:
choco source list
-
Add a new package source:
choco source add --name {{name}} --source {{url}}
-
Add a new package source with credentials:
choco source add --name {{name}} --source {{url}} --user {{username}} --password {{password}}
-
Add a new package source with a client certificate:
choco source add --name {{name}} --source {{url}} --cert {{path\to\certificate_file}}
-
Enable a package source:
choco source enable --name {{name}}
-
Disable a package source:
choco source disable --name {{name}}
-
Remove a package source:
choco source remove --name {{name}}
pwlauncher
Manage the Windows To Go startup options. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/pwlauncher.
-
Display the current Windows To Go status:
pwlauncher
-
Enable or disable the Windows To Go startup options:
pwlauncher /{{enable|disable}}
cuninst
This command is an alias of choco uninstall
.
More information: https://docs.chocolatey.org/en-us/choco/commands/uninstall.
- View documentation for the original command:
tldr choco uninstall
Resolve-Path
Resolves the wildcard characters in a path, and displays the path contents. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/resolve-path.
-
Resolve the home folder path:
Resolve-Path {{~}}
-
Resolve a UNC path:
Resolve-Path -Path "\\{{hostname}}\{{path\to\file}}"
-
Get relative paths:
Resolve-Path -Path {{path\to\file_or_directory}} -Relative
popd
Changes the current directory to the directory stored by the pushd
command.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/popd.
- Switch to directory at the top of the stack:
popd
title
Set the title of the command prompt window. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/title.
- Set the title of the current command prompt window:
title {{new_title}}
netstat
Displays active TCP connections, ports on which the computer is listening, network adapter statistics, the IP routing table, IPv4 statistics and IPv6 statistics. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/netstat.
-
Display active TCP connections:
netstat
-
Display all active TCP connections and the TCP and UDP ports on which the computer is listening:
netstat -a
-
Display network adapter statistics, such as the number of bytes and packets sent and received:
netstat -e
-
Display active TCP connections and express addresses and port numbers numerically:
netstat -n
-
Display active TCP connections and include the process ID (PID) for each connection:
netstat -o
-
Display the contents of the IP routing table:
netstat -r
-
Display statistics by protocol:
netstat -s
-
Display a list of currently open ports and related IP addresses:
netstat -an
repair-bde
Attempt to repair or decrypt a damaged BitLocker-encrypted volume. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/repair-bde.
-
Attempt to repair a specified volume:
repair-bde {{C:}}
-
Attempt to repair a specified volume and output to another volume:
repair-bde {{C:}} {{D:}}
-
Attempt to repair a specified volume using the provided recovery key file:
repair-bde {{C:}} -RecoveryKey {{path\to\file.bek}}
-
Attempt to repair a specified volume using the provided numerical recovery password:
repair-bde {{C:}} -RecoveryPassword {{password}}
-
Attempt to repair a specified volume using the provided password:
repair-bde {{C:}} -Password {{password}}
-
Attempt to repair a specified volume using the provided key package:
repair-bde {{C:}} -KeyPackage {{path\to\directory}}
-
Log all output to a specific file:
repair-bde {{C:}} -LogFile {{path\to\file}}
-
Display all available options:
repair-bde /?
Measure-Command
Measures the time it takes to run script blocks and cmdlets. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/measure-command.
-
Measure the time it takes to run a command:
Measure-Command { {{command}} }
-
Pipe input to Measure-Command (objects that are piped to
Measure-Command
are available to the script block that is passed to the Expression parameter):
10, 20, 50 | Measure-Command -Expression { for ($i=0; $i -lt $_; $i++) {$i} }
Set-Date
Changes the system time on the computer to a time that you specify. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/set-date.
-
Add three days to the system date:
Set-Date -Date (Get-Date).AddDays({{3}})
-
Set the system clock back 10 minutes:
Set-Date -Adjust -0:10:0 -DisplayHint Time
-
Add 90 minutes to the system clock:
$90mins = New-TimeSpan -Minutes {{90}}; Set-Date -Adjust $90mins
find
Find a specified string in one or more files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/find.
-
Find lines that contain a specified string:
find "{{string}}" {{path\to\file_or_directory}}
-
Display lines that do not contain the specified string:
find "{{string}}" {{path\to\file_or_directory}} /v
-
Display the count of lines that contain the specified string:
find "{{string}}" {{path\to\file_or_directory}} /c
-
Display line numbers with the list of lines:
find "{{string}}" {{path\to\file_or_directory}} /n
mount
Mount Network File System (NFS) network shares. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/mount.
-
Mount a share to the "Z" drive letter:
mount \\{{computer_name}}\{{share_name}} {{Z:}}
-
Mount a share to the next available drive letter:
mount \\{{computer_name}}\{{share_name}} *
-
Mount a share with a read timeout in seconds (defaults to 0.8, can be 0.9 or 1 to 60):
mount -o timeout={{seconds}} \\{{computer_name}}\{{share_name}} {{Z:}}
-
Mount a share and retry up to 10 times if it fails:
mount -o retry={{retries}} \\{{computer_name}}\{{share_name}} {{Z:}}
-
Mount a share with forced case sensitivity:
mount -o casesensitive \\{{computer_name}}\{{share_name}} {{Z:}}
-
Mount a share as an anonymous user:
mount -o anon \\{{computer_name}}\{{share_name}} {{Z:}}
-
Mount a share using a specific mount type:
mount -o mtype={{soft|hard}} \\{{computer_name}}\{{share_name}} {{Z:}}
reg compare
Compare keys and their values in the registry. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-compare.
-
Compare all values under a specific key with a second key:
reg compare {{first_key_name}} {{second_key_name}}
-
Compare a specific value under two keys:
reg compare {{first_key_name}} {{second_key_name}} /v {{value}}
-
Compare all sub keys and values for two keys:
reg compare {{first_key_name}} {{second_key_name}} /s
-
Only output the matches between the specified keys:
reg compare {{first_key_name}} {{second_key_name}} /os
-
Output the differences and matches between the specified keys:
reg compare {{first_key_name}} {{second_key_name}} /oa
del
Delete one or more files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/del.
-
Delete one or more space-separated files or patterns:
del {{file_pattern}}
-
Prompt for confirmation before deleting each file:
del {{file_pattern}} /p
-
Force the deletion of read-only files:
del {{file_pattern}} /f
-
Recursively delete file(s) from all subdirectories:
del {{file_pattern}} /s
-
Do not prompt when deleting files based on a global wildcard:
del {{file_pattern}} /q
-
Display the help and list available attributes:
del /?
-
Delete files based on specified attributes:
del {{file_pattern}} /a {{attribute}}
choco pack
Package a NuGet specification into a nupkg file. More information: https://chocolatey.org/docs/commands-pack.
-
Package a NuGet specification to a nupkg file:
choco pack {{path\to\specification_file}}
-
Package a NuGet specification specifying the version of the resulting file:
choco pack {{path\to\specification_file}} --version {{version}}
-
Package a NuGet specification to a specific directory:
choco pack {{path\to\specification_file}} --output-directory {{path\to\output_directory}}
getmac
Display the MAC addresses of a system. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/getmac.
-
Display the MAC addresses for the current system:
getmac
-
Display the details in a specific format:
getmac /fo {{table|list|csv}}
-
Exclude the header in the output list:
getmac /nh
-
Display the MAC addresses for a remote machine:
getmac /s {{hostname}} /u {{username}} /p {{password}}
-
Display the MAC addresses with verbose information:
getmac /v
-
Display detailed usage information:
getmac /?
takeown
Take ownership of a file or directory. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/takeown.
-
Take ownership of the specified file:
takeown /f {{path\to\file}}
-
Take ownership of the specified directory:
takeown /d {{path\to\directory}}
-
Take ownership of the specified directory and all subdirectories:
takeown /r /d {{path\to\directory}}
-
Change ownership to the Administrator group instead of the current user:
takeown /a /f {{path\to\file}}
choco search
Search for a local or remote package with Chocolatey. More information: https://chocolatey.org/docs/commands-search.
-
Search for a package:
choco search {{query}}
-
Search for a package locally:
choco search {{query}} --local-only
-
Only include exact matches in the results:
choco search {{query}} --exact
-
Confirm all prompts automatically:
choco search {{query}} --yes
-
Specify a custom source to search for packages in:
choco search {{query}} --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco search {{query}} --user {{username}} --password {{password}}
Measure-Object
Calculates the numeric properties of objects, and the characters, words, and lines in string objects, such as files of text. This command can only be used through PowerShell. More information: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/measure-object.
-
Count the files and folders in a directory:
Get-ChildItem | Measure-Object
-
Pipe input to Measure-Command (objects that are piped to
Measure-Command
are available to the script block that is passed to the Expression parameter):
"One", "Two", "Three", "Four" | Set-Content -Path "{{path\to\file}}"; Get-Content "{{path\to\file}}"; | Measure-Object -Character -Line -Word
clip
Copy input content to the Windows clipboard. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/clip.
-
Pipe command-line output to the Windows clipboard:
{{dir}} | clip
-
Copy the contents of a file to the Windows clipboard:
clip < {{path\to\file.ext}}
-
Copy text with a trailing newline to the Windows clipboard:
echo {{some text}} | clip
-
Copy text without a trailing newline to the Windows clipboard:
echo | set /p="some text" | clip
Get-FileHash
Calculate a hash for a file. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-filehash.
-
Calculate a hash for a specified file using the SHA256 algorithm:
Get-FileHash {{path\to\file}}
-
Calculate a hash for a specified file using a specified algorithm:
Get-FileHash {{path\to\file}} -Algorithm {{SHA1|SHA384|SHA256|SHA512|MD5}}
wsl-open
Open a file or URL from within Windows Subsystem for Linux in the user's default Windows GUI application. More information: https://gitlab.com/4U6U57/wsl-open.
-
Open the current directory in Windows Explorer:
wsl-open {{.}}
-
Open a URL in the user's default web browser in Windows:
wsl-open {{https://example.com}}
-
Open a specific file in the user's default application in Windows:
wsl-open {{path\to\file}}
-
Set
wsl-open
as the shell's web browser (open links withwsl-open
):
wsl-open -w
-
Display help:
wsl-open -h
sc
Communicate with the Service Control Manager and services. More information: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/sc-query.
-
Show the status of a service (no service name will list all services):
sc queryex {{service_name}}
-
Start a service asynchronously:
sc start {{service_name}}
-
Stop a service asynchronously:
sc stop {{service_name}}
-
Set the type of a service:
sc config {{service_name}} type= {{service_type}}
reg import
Import all available keys, subkeys, and values from a file. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-import.
- Import all keys, subkeys and values from a file:
reg import {{path\to\file.reg}}
chrome
This command is an alias of chromium
.
More information: https://chrome.google.com.
- View documentation for the original command:
tldr chromium
chkdsk
Check file system and volume metadata for errors. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/chkdsk.
-
Specify the drive letter (followed by a colon), mount point, or volume name to check:
chkdsk {{volume}}
-
Fix errors on a specific volume:
chkdsk {{volume}} /f
-
Dismount a specific volume before checking:
chkdsk {{volume}} /x
-
Change the log file size to the specified size (only for NTFS):
chkdsk /l{{size}}
systeminfo
Display operating system configuration for a local or remote machine. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/systeminfo.
-
Display system configuration for the local machine:
systeminfo
-
Display system configuration in a specified output format:
systeminfo /fo {{table|list|csv}}
-
Display system configuration for a remote machine:
systeminfo /s {{remote_name}} /u {{username}} /p {{password}}
-
Display detailed usage information:
systeminfo /?
choco apikey
Manage API keys for Chocolatey sources. More information: https://chocolatey.org/docs/commands-apikey.
-
Display a list of sources and their API keys:
choco apikey
-
Display a specific source and its API key:
choco apikey --source "{{source_url}}"
-
Set an API key for a source:
choco apikey --source "{{source_url}}" --key "{{api_key}}"
-
Remove an API key for a source:
choco apikey --source "{{source_url}}" --remove
reg restore
Restore a key and its values from a backup file.
See reg-save
for more information.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-restore.
- Overwrite a specified key with data from a backup file:
reg restore {{key_name}} {{path\to\file}}
wsl
Manage the Windows Subsystem for Linux. More information: https://learn.microsoft.com/windows/wsl/reference.
-
Start a Linux shell (in the default distribution):
wsl {{shell_command}}
-
Run a Linux command without using a shell:
wsl --exec {{command}} {{command_arguments}}
-
Specify a particular distribution:
wsl --distribution {{distribution}} {{shell_command}}
-
List available distributions:
wsl --list
-
Export a distribution to a
.tar
file:
wsl --export {{distribution}} {{path\to\distro_file.tar}}
-
Import a distribution from a
.tar
file:
wsl --import {{distribution}} {{path\to\install_location}} {{path/to/distro_file.tar}}
-
Change the version of wsl used for the specified distribution:
wsl --set-version {{distribution}} {{version}}
-
Shut down Windows Subsystem for Linux:
wsl --shutdown
psping
A ping tool that includes TCP ping, latency and bandwidth measurement. More information: https://learn.microsoft.com/sysinternals/downloads/psping.
-
Ping a host using ICMP:
psping {{hostname}}
-
Ping a host over a TCP port:
psping {{hostname}}:{{port}}
-
Specify the number of pings and perform it quietly:
psping {{hostname}} -n {{pings}} -q
-
Ping the target over TCP 50 times and produce a histogram of the results:
psping {{hostname}}:{{port}} -q -n {{50}} -h
-
Display usage information:
psping /?
rpcinfo
List programs via RPC on remote computers. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/rpcinfo.
-
List all programs registered on the local computer:
rpcinfo
-
List all programs registered on a remote computer:
rpcinfo /p {{computer_name}}
-
Call a specific program on a remote computer using TCP:
rpcinfo /t {{computer_name}} {{program_name}}
-
Call a specific program on a remote computer using UDP:
rpcinfo /u {{computer_name}} {{program_name}}
choco pin
Pin a package at a specific version with Chocolatey. Pinned packages are skipped automatically when upgrading. More information: https://chocolatey.org/docs/commands-pin.
-
Display a list of pinned packages and their versions:
choco pin list
-
Pin a package at its current version:
choco pin add --name {{package}}
-
Pin a package at a specific version:
choco pin add --name {{package}} --version {{version}}
-
Remove a pin for a specific package:
choco pin remove --name {{package}}
ftype
Display or modify file types used for file extension association. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/ftype.
-
Display a list of all file types:
ftype
-
Display the associated program for a specific file type:
ftype {{file_type}}
-
Set the associated program for a specific file type:
ftype {{file_type}}="{{path/to/executable_file}}"
sls
This command is an alias of Select-String
.
More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string.
- View documentation for the original command:
tldr where-object
tree
Display a graphical tree of the directory structure for a path. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/tree.
-
Display the tree for the current directory:
tree
-
Display the tree for a specific directory:
tree {{path\to\directory}}
-
Display the tree for a directory including files:
tree {{path\to\directory}} /f
-
Display the tree using ASCII characters instead of extended characters:
tree {{path\to\directory}} /a
explorer
The Windows File Explorer. More information: https://ss64.com/nt/explorer.html.
-
Open Windows Explorer:
explorer
-
Open Windows Explorer in the current directory:
explorer .
-
Open Windows Explorer in a specific directory:
explorer {{path\to\directory}}
choco list
Display a list of packages with Chocolatey. More information: https://chocolatey.org/docs/commands-list.
-
Display all available packages:
choco list
-
Display all locally installed packages:
choco list --local-only
-
Display a list including local programs:
choco list --include-programs
-
Display only approved packages:
choco list --approved-only
-
Specify a custom source to display packages from:
choco list --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco list --user {{username}} --password {{password}}
psexec
Execute a command-line process on a remote machine. This is an advanced command and it might potentially be dangerous. More information: https://learn.microsoft.com/en-us/sysinternals/downloads/psexec.
-
Execute a command using
cmd
in a remote shell:
psexec \\{{remote_host}} cmd
-
Execute a command on a remote host (pre-authenticated):
psexec \\{{remote_host}} -u {{user_name}} -p {{password}}
-
Execute a command remotely and output the result to a file:
psexec \\{{remote_host}} cmd /c {{command}} -an ^>{{path\to\file.txt}}
-
Execute a program to interact with users:
psexec \\{{remote_host}} -d -i {{program_name}}
-
Display the IP configuration of the remote host:
psexec \\{{remote_host}} ipconfig /all
gpupdate
A tool to check and apply Windows Group Policy settings. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/gpupdate.
-
Check and apply updated Group Policy settings:
gpupdate
-
Specify the target Group Policy settings to check for update:
gpupdate /target:{{computer|user}}
-
Force all Group Policy settings to be reapplied:
gpupdate /force
-
Display detailed usage information:
gpupdate /?
findstr
Find specified text within one or more files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/findstr.
-
Find space-separated string(s) in all files:
findstr "{{query}}" *
-
Find space-separated string(s) in a piped command's output:
{{dir}} | findstr "{{query}}"
-
Find space-separated string(s) in all files recur[s]ively:
findstr /s "{{query}}" *
-
Find strings using a case-insensitive search:
findstr /i "{{query}}" *"
-
Find strings in all files using regular expressions:
findstr /r "{{expression}}" *
-
Find a literal string (containing spaces) in all text files:
findstr /c:"{{query}}" *.txt
-
Display the line number before each matching line:
findstr /n "{{query}}" *
-
Display only the filenames that contain a match:
findstr /m "{{query}}" *
where
This command is an alias of Where-Object
.
More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/where-object.
- View documentation for the original command:
tldr Where-Object
curl
In PowerShell, this command may be an alias ofInvoke-WebRequest
when the originalcurl
program (https://curl.se) is not properly installed.
-
Check whether
curl
is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command withInvoke-WebRequest
:
curl --version
-
View documentation for the original
curl
command:
tldr curl -p common
-
View documentation for the original
curl
command in older versions oftldr
command-line client:
tldr curl -o common
-
View documentation for PowerShell's
Invoke-WebRequest
command:
tldr invoke-webrequest
xcopy
Copy files and directory trees. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/xcopy.
-
Copy the file(s) to the specified destination:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}}
-
List files that will be copied before copying:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /p
-
Copy the directory structure only, excluding files:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /t
-
Include empty directories when copying:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /e
-
Keep the source ACL in the destination:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /o
-
Allow resuming when network connection is lost:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /z
-
Disable the prompt when the file exists in the destination:
xcopy {{path\to\file_or_directory}} {{path\to\destination_directory}} /y
-
Display detailed usage information:
xcopy /?
bleachbit_console
Clean junk files on the filesystem. More information: https://docs.bleachbit.org/doc/command-line-interface.html.
-
Perform the clean-up operation and delete files:
bleachbit_console.exe --clean
-
Preview the files that will be deleted and other changes that will be made before actually performing the clean-up operation:
bleachbit_console.exe --preview
-
Display system information:
bleachbit_console.exe --sysinfo
-
Start the graphical user interface (GUI) version of Bleachbit:
bleachbit_console.exe --gui
-
Display version:
bleachbit_console.exe --version
sfc
Scans the integrity of Windows system files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/sfc.
-
Display information about the usage of the command:
sfc
-
Scan all system files and, if possible, repair any problems:
sfc /scannow
-
Scan all system files without attempting to repair any:
sfc /verifyonly
-
Scan a specific file and, if possible, repair any problems:
sfc /scanfile={{path\to\file}}
-
Scan a specific file without attempting to repair it:
sfc /verifyfile={{path\to\file}}
-
When repairing offline, specify the boot directory:
sfc /offbootdir={{path\to\directory}}
-
When repairing offline, specify the Windows directory:
sfc /offwindir={{path\to\directory}}
wget
In PowerShell, this command may be an alias ofInvoke-WebRequest
when the originalwget
program (https://www.gnu.org/software/wget) is not properly installed.
-
Check whether
wget
is properly installed by printing its version number. If this command evaluates into an error, PowerShell may have substituted this command withInvoke-WebRequest
:
curl --version
-
View documentation for the original
wget
command:
tldr wget -p common
-
View documentation for the original
wget
command in older versions oftldr
command-line client:
tldr wget -o common
-
View documentation for PowerShell's
Invoke-WebRequest
command:
tldr invoke-webrequest
setx
Sets persistent environment variables. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/setx.
-
Set an environment variable for the current user:
setx {{variable}} {{value}}
-
Set an environment variable for the current machine:
setx {{variable}} {{value}} /M
-
Set an environment variable for a user on a remote machine:
setx /s {{hostname}} /u {{username}} /p {{password}} {{variable}} {{value}}
-
Set an environment variable from a registry key value:
setx {{variable}} /k {{registry\key\path}}
cls
Clears the screen. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/cls.
- Clear the screen:
cls
fsutil
Displays information about file system volumes. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/fsutil.
-
Display a list of volumes:
fsutil volume list
-
Display information about a volume's file system:
fsutil fsInfo volumeInfo {{drive_letter|volume_path}}
-
Display the current state of the file system auto-repair for all volumes:
fsutil repair state
-
Display the dirty bit state of all volumes:
fsutil dirty query
-
Set the dirty bit state of a volume:
fsutil dirty set {{drive_letter|volume_path}}
fc
Compare the differences between two files or sets of files. Use wildcards (*) to compare sets of files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/fc.
-
Compare 2 specified files:
fc {{path\to\file1}} {{path\to\file2}}
-
Perform a case-insensitive comparison:
fc /c {{path\to\file1}} {{path\to\file2}}
-
Compare files as Unicode text:
fc /u {{path\to\file1}} {{path\to\file2}}
-
Compare files as ASCII text:
fc /l {{path\to\file1}} {{path\to\file2}}
-
Compare files as binary:
fc /b {{path\to\file1}} {{path\to\file2}}
-
Disable tab-to-space expansion:
fc /t {{path\to\file1}} {{path\to\file2}}
-
Compress whitespace (tabs and spaces) for comparisons:
fc /w {{path\to\file1}} {{path\to\file2}}
tasklist
Display a list of currently running processes on a local or remote machine. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/tasklist.
-
Display currently running processes:
tasklist
-
Display running processes in a specified output format:
tasklist /fo {{table|list|csv}}
-
Display running processes using the specified
.exe
or.dll
file name:
tasklist /m {{module_pattern}}
-
Display processes running on a remote machine:
tasklist /s {{remote_name}} /u {{username}} /p {{password}}
-
Display services using each process:
tasklist /svc
Where-Object
Selects objects from a collection based on their property values. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/where-object.
-
Filter aliases by its name:
Get-Alias | Where-Object -{{Property}} {{Name}} -{{eq}} {{name}}
-
Get a list of all services that are currently stopped. The
$_
automatic variable represents each object that is passed to theWhere-Object
cmdlet:
Get-Service | Where-Object {$_.Status -eq "Stopped"}
-
Use multiple conditions:
Get-Module -ListAvailable | Where-Object { $_.Name -NotLike "Microsoft*" -And $_.Name -NotLike "PS*" }
date
Displays or sets the system date. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/date.
-
Display the current system date and prompt to enter a new date (leave empty to keep unchanged):
date
-
Display the current system date without prompting for a new date:
date /t
-
Change the current system date to a specific date:
date {{month}}-{{day}}-{{year}}
ipconfig
Display and manage the network configuration of Windows. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/ipconfig.
-
Show a list of network adapters:
ipconfig
-
Show a detailed list of network adapters:
ipconfig /all
-
Renew the IP addresses for a network adapter:
ipconfig /renew {{adapter}}
-
Free up the IP addresses for a network adapter:
ipconfig /release {{adapter}}
-
Show the local DNS cache:
ipconfig /displaydns
-
Remove all data from the local DNS cache:
ipconfig /flushdns
forfiles
Select one or more files to execute a specified command on. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/forfiles.
-
Search for files in the current directory:
forfiles
-
Search for files in a specific directory:
forfiles /p {{path\to\directory}}
-
Run the specified command for each file:
forfiles /c "{{command}}"
-
Search for files using a specific glob mask:
forfiles /m {{glob_pattern}}
-
Search for files recursively:
forfiles /s
-
Search for files older than 5 days:
forfiles /d +{{5}}
pabcnetcclear
Preprocess and compile PascalABC.NET source files. More information: http://pascalabc.net.
-
Compile the specified source file into an executable with the same name:
pabcnetcclear {{path\to\source_file.pas}}
-
Compile the specified source file into an executable with the specified name:
pabcnetcclear /Output:{{path\to\_file.exe}} {{path\to\source_file.pas}}
-
Compile the specified source file into an executable with the same name along with/without debug information:
pabcnetcclear /Debug:{{0|1}} {{path\to\source_file.pas}}
-
Allow units to be searched in the specified path while compiling the source file into an executable with the same name:
pabcnetcclear /SearchDir:{{path\to\directory}} {{path\to\source_file.pas}}
-
Compile the specified source file into an executable, defining a symbol:
pabcnetcclear /Define:{{symbol}} {{path\to\source_file.pas}}
Get-ChildItem
List items in a directory. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-childitem.
-
List all non-hidden items in the current directory:
Get-ChildItem
-
List only directories in the current directory:
Get-ChildItem -Directory
-
List only files in the current directory:
Get-ChildItem -File
-
List items in the current directory, including hidden items:
Get-ChildItem -Hidden
-
List items in a directory other than the current one:
Get-ChildItem -Path {{path\to\directory}}
octo
Command-line tools for Octopus Deploy. More information: https://octopus.com/docs/octopus-rest-api/octo.exe-command-line.
-
Create a package:
octo pack --id={{package}}
-
Push a package to a repository on the Octopus server:
octo push --package={{package}}
-
Create a release:
octo create-release --project={{project_name}} --packageversion={{version}}
-
Deploy a release:
octo deploy-release --project={{project_name}} --packageversion={{version}} --deployto={{environment_name}} --tenant={{deployment_target}}
msiexec
Install, update, repair, or uninstall Windows programs using MSI and MSP package files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/msiexec.
-
Install a program from its MSI package:
msiexec /package {{path\to\file.msi}}
-
Install a MSI package from a website:
msiexec /package {{https://example.com/installer.msi}}
-
Install a MSP patch file:
msiexec /update {{path\to\file.msp}}
-
Uninstall a program or patch using their respective MSI or MSP file:
msiexec /uninstall {{path\to\file}}
time
Display or set the system time. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/time.
-
Display the current system time and prompt to enter a new time (leave empty to keep unchanged):
time
-
Display the current system time without prompting for a new time:
time /t
pipwin
A tool to install unofficial Python package binaries on Windows. More information: https://github.com/lepisma/pipwin.
-
List all available packages for download:
pipwin list
-
Search packages:
pipwin search {{partial_name|name}}
-
Install a package:
pipwin install {{package}}
-
Uninstall a package:
pipwin uninstall {{package}}
-
Download a package to a specific directory:
pipwin download --dest {{path\to\directory}} {{package}}
-
Install packages according to
requirements.txt
:
pipwin install --file {{path\to\requirements.txt}}
Get-Date
Gets the current date and time. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/get-date.
-
Display the current date and time:
Get-Date
-
Display the current date and time with a .NET format specifier:
Get-Date -Format "{{yyyy-MM-dd HH:mm:ss}}"
-
Display the current date and time in UTC and ISO 8601 format:
(Get-Date).ToUniversalTime()
-
Convert a Unix timestamp:
Get-Date -UnixTimeSeconds {{1577836800}}
Stop-Service
Stops one or more running services. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/stop-service.
-
Stop a service on the local computer:
Stop-Service -Name {{service_name}}
-
Stop a service by using the display name:
Stop-Service -DisplayName "{{name}}"
-
Stop a service that has dependent services:
Stop-Service -Name {{service_name}} -Force -Confirm
clist
This command is an alias of choco list
.
More information: https://docs.chocolatey.org/en-us/choco/commands/list.
- View documentation for the original command:
tldr choco list
virtualboxvm
Manage VirtualBox virtual machines. More information: https://www.virtualbox.org.
-
Start a virtual machine:
virtualboxvm --startvm {{name|uuid}}
-
Start a virtual machine in fullscreen mode:
virtualboxvm --startvm {{name|uuid}} --fullscreen
-
Mount the specified DVD image file:
virtualboxvm --startvm {{name|uuid}} --dvd {{path\to\image_file}}
-
Display a command-line window with debug information:
virtualboxvm --startvm {{name|uuid}} --debug-command-line
-
Start a virtual machine in a paused state:
virtualboxvm --startvm {{name|uuid}} --start-paused
reg save
Save a registry key, its sub keys and values to a file. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-save.
-
Save a registry key, its sub keys and values to a specific file:
reg save {{key_name}} {{path\to\file}}
-
Forcefully overwrite an existing file without a prompt:
reg save {{key_name}} {{path\to\file}} /y
choco install
Install one or more packages with Chocolatey. More information: https://chocolatey.org/docs/commands-install.
-
Install one or more space-separated packages:
choco install {{package1 package2 ...}}
-
Install packages from a custom configuration file:
choco install {{path\to\packages_file.config}}
-
Install a specific nuspec or nupkg file:
choco install {{path\to\file}}
-
Install a specific version of a package:
choco install {{package}} --version {{version}}
-
Allow installing multiple versions of a package:
choco install {{package}} --allow-multiple
-
Confirm all prompts automatically:
choco install {{package}} --yes
-
Specify a custom source to receive packages from:
choco install {{package}} --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco install {{package}} --user {{username}} --password {{password}}
choco uninstall
Uninstall one or more packages with Chocolatey. More information: https://chocolatey.org/docs/commands-uninstall.
-
Uninstall one or more space-separated packages:
choco uninstall {{package1 package2 ...}}
-
Uninstall a specific version of a package:
choco uninstall {{package}} --version {{version}}
-
Confirm all prompts automatically:
choco uninstall {{package}} --yes
-
Remove all dependencies when uninstalling:
choco uninstall {{package}} --remove-dependencies
-
Uninstall all packages:
choco uninstall all
dir
List directory contents. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/dir.
-
Show the contents of the current directory:
dir
-
Show the contents of a given directory:
dir {{path\to\directory}}
-
Show the contents of the current directory, including hidden ones:
dir /A
-
Show the contents of a given directory, including hidden ones:
dir {{path\to\directory}} /A
cmd
The Windows command interpreter. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/cmd.
-
Start an interactive shell session:
cmd
-
Execute specific [c]ommands:
cmd /c {{echo Hello world}}
-
Execute a specific script:
cmd {{path\to\script.bat}}
-
Execute specific commands and then enter an interactive shell:
cmd /k {{echo Hello world}}
-
Start an interactive shell session where
echo
is disabled in command output:
cmd /q
-
Start an interactive shell session with delayed [v]ariable expansion enabled or disabled:
cmd /v:{{on|off}}
-
Start an interactive shell session with command [e]xtensions enabled or disabled:
cmd /e:{{on|off}}
-
Start an interactive shell session with used [u]nicode encoding:
cmd /u
cmdkey
Create, show, and delete stored user names and passwords. More information: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmdkey.
-
Show a list of all user credentials:
cmdkey /list
-
Store credentials for a user that accesses a server:
cmdkey /add:{{server_name}} /user:{{user_name}}
-
Delete credentials for a specific target:
cmdkey.exe /delete {{target_name}}
driverquery
Display information about installed device drivers. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/driverquery.
-
Display a list of all installed device drivers:
driverquery
-
Display a list of drivers in the specified format:
driverquery /fo {{table|list|csv}}
-
Display a list of drivers with a column to indicate if they are signed:
driverquery /si
-
Exclude the header in the output list:
driverquery /nh
-
Display a list of drivers for a remote machine:
driverquery /s {{hostname}} /u {{username}} /p {{password}}
-
Display a list of drivers with verbose information:
driverquery /v
-
Display detailed usage information:
driverquery /?
query
Displays information about user sessions and process. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/query.
-
Display all user sessions:
query session
-
Display the current user sessions on a remote computer:
query session /server:{{hostname}}
-
Display logged in users:
query user
-
Display all user sessions on a remote computer:
query session /server:{{hostname}}
-
Display all running processes:
query process
-
Display running processes by session or user name:
query process {{session_name|user_name}}
reg export
Export the specified sub keys and values into a file. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-export.
-
Export all sub keys and values of a specific key:
reg export {{key_name}} {{path\to\file.reg}}
-
Force overwriting of an existing file without prompt:
reg export {{key_name}} {{path\to\file.reg}} /y
reg
Manage keys and their values in the Windows registry.
Some subcommands such as reg add
have their own usage documentation.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg.
-
Execute a registry command:
reg {{command}}
-
Display general information and list all available commands:
reg /?
-
Call help on a specific command:
reg {{command}} /?
ftp
Interactively transfer files between a local and remote FTP server. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/ftp.
-
Connect to a remote FTP server interactively:
ftp {{host}}
-
Log in as an anonymous user:
ftp -A {{host}}
-
Disable automatic login upon initial connection:
ftp -n {{host}}
-
Run a file containing a list of FTP commands:
ftp -s:{{path\to\file}} {{host}}
-
Download multiple files (glob expression):
mget {{*.png}}
-
Upload multiple files (glob expression):
mput {{*.zip}}
-
Delete multiple files on the remote server:
mdelete {{*.txt}}
-
Display detailed help:
ftp --help
showmount
Display information about NFS filesystems on Windows Server. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/showmount.
-
Display all exported filesystems:
showmount -e
-
Display all NFS clients and their mounted directories:
showmount -a
-
Display all NFS mounted directories:
showmount -d
-
Display all exported filesystems for a remote server:
showmount -e {{server_address}}
taskkill
Terminate a process by its process ID or name. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/taskkill.
-
Terminate a process by its ID:
taskkill /pid {{process_id}}
-
Terminate a process by its name:
taskkill /im {{process_name}}
-
Forcefully terminate a specified process:
taskkill /pid {{process_id}} /f
-
Terminate a process and its child processes:
taskkill /im {{process_name}} /t
-
Terminate a process on a remote machine:
taskkill /pid {{process_id}} /s {{remote_name}}
-
Display information about the usage of the command:
taskkill /?
pathping
A trace route tool combining features ofping
andtracert
. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/pathping.
-
Ping and trace the route to a host:
pathping {{hostname}}
-
Do not perform reverse lookup of IP address to hostname:
pathping {{hostname}} -n
-
Specify the maximum number of hops to search for the target (the default is 30):
pathping {{hostname}} -h {{max_hops}}
-
Specify the milliseconds to wait between pings (the default is 240):
pathping {{hostname}} -p {{time}}
-
Specify the number of queries per hop (the default is 100):
pathping {{hostname}} -q {{queries}}
-
Force IPV4 usage:
pathping {{hostname}} -4
-
Force IPV6 usage:
pathping {{hostname}} -6
-
Display detailed usage information:
pathping /?
subst
Associates a path with a virtual drive letter. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/subst.
-
List active associations:
subst
-
Add an association:
subst {{Z:}} {{C:\Python2.7}}
-
Remove an association:
subst {{Z:}} /d
vswhere
Locate Visual Studio 2017 and newer installations. More information: https://github.com/microsoft/vswhere.
-
Find the path of vcvarsall.bat to set environment variables:
vswhere -products * -latest -prerelease -find **\VC\Auxiliary\Build\vcvarsall.bat
-
Find the directory of the x64 MSVC compiler (cl.exe, etc):
vswhere -products * -latest -prerelease -find **\Hostx64\x64\*
-
Find the directory of Clang bundled with Visual Studio bundled (clang-cl, clang-tidy, etc):
vswhere -products * -latest -prerelease -find **\Llvm\bin\*
-
Find the path of
MSBuild.exe
:
vswhere -products * -latest -prerelease -find MSBuild\**\Bin\MSBuild.exe
iwr
This command is an alias of Invoke-WebRequest
in PowerShell.
- View documentation for the original command:
tldr invoke-webrequest
netsh interface portproxy
Configure and display the status of various network components. More information: https://learn.microsoft.com/en-us/windows-server/networking/technologies/netsh/netsh-interface-portproxy.
-
Display the current port forwarding setup:
netsh interface portproxy show all
-
Set up IPv4 port forwarding (run in elevated console):
netsh interface portproxy add v4tov4 listenaddress={{192.168.0.1}} listenport={{8080}} connectaddress={{10.0.0.1}} connectport={{80}}
-
Remove IPv4 port forwarding (run in elevated console):
netsh interface portproxy delete v4tov4 listenaddress={{192.168.0.1}} listenport={{8080}}
-
Display help:
netsh interface portproxy
vcvarsall
Setup the environment variables required for using the Microsoft Visual Studio tools. The path ofvcvarsall
for a certain Visual Studio installation can be found usingvswhere
. More information: https://learn.microsoft.com/cpp/build/building-on-the-command-line.
-
Setup the environment for native x64:
vcvarsall x64
-
Setup the environment for cross-compiled native x86 from the x64 host:
vcvarsall x64_x86
-
Setup the environment for cross-compiled native Arm x64 from the x64 host:
vcvarsall x64_arm64
-
Setup the environment for native UWP x64:
vcvarsall x64 uwp
slmgr.vbs
Install, activate, and manage Windows licenses. This command may override, deactivate, and/or remove your current Windows license. Please proceed with caution. More information: https://docs.microsoft.com/windows-server/get-started/activation-slmgr-vbs-options.
-
[d]isplay the current Windows [l]icense [i]nformation:
slmgr /dli
-
[d]isplay the ins[t]allation [i]D for the current device. Useful for offline license activation:
slmgr /dti
-
Display the current license's e[xp]i[r]ation date and time:
slmgr /xpr
-
[i]nstall a new Windows license [p]roduct [k]ey. Requires Administrator privileges and will override the existing license:
slmgr /ipk {{product_key}}
-
[a]c[t]ivate the Windows product license [o]nline. Requires Administrator privileges to do so:
slmgr /ato
-
[a]c[t]ivate the Windows [p]roduct license offline. Requires Administrator privileges and an Confirmation ID provided by Microsoft Product Activation Center:
slmgr /atp {{confirmation_id}}
-
[c]lear the current license's [p]roduct [k]e[y] from the Windows Registry. This will not deactivate or uninstall the current license, but prevents the key from being stolen by malicious programs in the future:
slmgr /cpky
-
[u]ninstall the current license (by its [p]roduct [k]ey):
slmgr /upk
set
Display or set environment variables for the current instance of CMD. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/set.
-
List all current environment variables:
set
-
Set an environment variable to a specific value:
set {{name}}={{value}}
-
List environment variables starting with the specified string:
set {{name}}
-
Prompt the user for a value for the specified variable:
set /p {{name}}={{prompt_string}}
cd
Display the current working directory or move to a different directory. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/cd.
-
Display the path of the current directory:
cd
-
Go to root of current drive:
cd \
-
Go up to the parent of the current directory:
cd ..
-
Go to a specific directory in the same drive:
cd {{path\to\directory}}
-
Go to a specific directory in a different [d]rive:
cd /d {{C}}:{{path\to\directory}}
path
Display or set the search path for executable files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/path.
-
Display the current path:
path
-
Set the path to one or more semicolon-separated directories:
path {{path\to\directory1 path\to\directory2 ...}}
-
Append a new directory to the original path:
path {{path\to\directory}};%path%
-
Set command prompt to only search the current directory for executables:
path ;
for
Conditionally execute a command several times. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/for.
-
Execute given commands for the specified set:
for %{{variable}} in ({{item_a item_b item_c}}) do ({{echo Loop is executed}})
-
Iterate over a given range of numbers:
for /l %{{variable}} in ({{from}}, {{step}}, {{to}}) do ({{echo Loop is executed}})
-
Iterate over a given list of files:
for %{{variable}} in ({{path\to\file1.ext path\to\file2.ext ...}}) do ({{echo Loop is executed}})
-
Iterate over a given list of directories:
for /d %{{variable}} in ({{path\to\directory1.ext path\to\directory2.ext ...}}) do ({{echo Loop is executed}})
-
Perform a given command in every directory:
for /d %{{variable}} in (*) do (if exist %{{variable}} {{echo Loop is executed}})
Get-Content
Get the content of the item at the specified location. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/get-content.
-
Display the content of a file:
Get-Content -Path {{path\to\file}}
-
Display the first few lines of a file:
Get-Content -Path {{path\to\file}} -TotalCount {{10}}
-
Display the content of the file and keep reading from it until
Ctrl + C
is pressed:
Get-Content -Path {{path\to\file}} -Wait
expand
Uncompress one or more Windows Cabinet files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/expand.
-
Uncompress a single-file Cabinet file to the specified directory:
expand {{path\to\file.cab}} {{path\to\directory}}
-
Display the list of files in a source Cabinet file:
expand {{path\to\file.cab}} {{path\to\directory}} -d
-
Uncompress all files from the Cabinet file:
expand {{path\to\file.cab}} {{path\to\directory}} -f:*
-
Uncompress a specific file from a Cabinet file:
expand {{path\to\file.cab}} {{path\to\directory}} -f:{{path\to\file}}
-
Ignore the directory structure when uncompressing, and add them to a single directory:
expand {{path\to\file.cab}} {{path\to\directory}} -i
Get-History
Display PowerShell command history. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.core/get-history.
-
Display the commands history list with ID:
Get-History
-
Get PowerShell history item by ID:
Get-History -Id {{id}}
-
Display the last N commands:
Get-History -Count {{10}}
doskey
Manage macros, windows commands and command-lines. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/doskey.
-
List available macros:
doskey /macros
-
Create a new macro:
doskey {{name}} = "{{command}}"
-
Create a new macro for a specific executable:
doskey /exename={{executable}} {{name}} = "{{command}}"
-
Remove a macro:
doskey {{name}} =
-
Display all commands that are stored in memory:
doskey /history
-
Save macros to a file for portability:
doskey /macros > {{path\to\macinit_file}}
-
Load macros from a file:
doskey /macrofile = {{path\to\macinit_file}}
ver
Display the current Windows or MS-DOS version number. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/ver.
- Display the current version number:
ver
prompt
Change the default DOS style prompt in a command window. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/prompt.
-
Reset the prompt to the default setting:
prompt
-
Set a specific prompt:
prompt {{prompt}}
-
Change the prompt to show the current date first:
prompt $D $P$G
-
Change the prompt to show the current time first:
prompt $T $P$G
-
Change the prompt by adding a specific text first:
prompt {{text}} $P$G
Get-Acl
Gets the security descriptor for a resource, such as a file or registry key. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.security/get-acl.
-
Display the ACL for a specific directory:
Get-Acl {{path\to\directory}}
-
Get an ACL for a registry key:
Get-Acl -Path {{HKLM:\System\CurrentControlSet\Control}} | Format-List
choco new
Generate new package specification files with Chocolatey. More information: https://chocolatey.org/docs/commands-new.
-
Create a new package skeleton:
choco new {{package}}
-
Create a new package with a specific version:
choco new {{package}} --version {{version}}
-
Create a new package with a specific maintainer name:
choco new {{package}} --maintainer {{maintainer_name}}
-
Create a new package in a custom output directory:
choco new {{package}} --output-directory {{path/to/directory}}
-
Create a new package with specific 32-bit and 64-bit installer URLs:
choco new {{package}} url="{{url}}" url64="{{url}}"
cipher
Display or alter the encryption of directories and files on NTFS volumes. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/cipher.
-
Display information about a specific encrypted file or directory:
cipher /c:{{path\to\file_or_directory}}
-
[e]ncrypt a file or directory (files added later to the directory are also encrypted as the directory is marked):
cipher /e:{{path\to\file_or_directory}}
-
[d]ecrypt a file or directory:
cipher /d:{{path\to\file_or_directory}}
-
Securely remove a file or directory:
cipher /w:{{path\to\file_or_directory}}
cpush
This command is an alias of choco push
.
More information: https://docs.chocolatey.org/en-us/create/commands/push.
- See documentation for the original command:
tldr choco-push
Select-String
Finds text in strings and files in PowerShell.
This command can only be used through PowerShell.
You can use Select-String
similar to grep in UNIX or findstr.exe in Windows.
More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/select-string.
-
Search for a pattern within a file:
Select-String -Path "{{path\to\file}}" -Pattern '{{search_pattern}}'
-
Search for an exact string (disables regular expressions):
Select-String -SimpleMatch "{{exact_string}}" {{path\to\file}}
-
Search for pattern in all
.ext
files in current dir:
Select-String -Path "{{*.ext}}" -Pattern '{{search_pattern}}'
-
Capture the specified number of lines before and after the line that matches the pattern:
Select-String --Context {{2,3}} "{{search_pattern}}" {{path\to\file}}
-
Search
stdin
for lines that do not match a pattern:
Get-Content {{path\to\file}} | Select-String --NotMatch "{{search_pattern}}"
reg copy
Copy keys and their values in the registry. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-copy.
-
Copy a registry key to a new registry location:
reg copy {{old_key_name}} {{new_key_name}}
-
Copy a registry key recursively to a new registry location:
reg copy {{old_key_name}} {{new_key_name}} /s
-
Forcefully copy a registry key without a prompt:
reg copy {{old_key_name}} {{new_key_name}} /f
pushd
Place a directory on a stack so it can be accessed later.
See also popd
to switch back to original directory.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/pushd.
- Switch to directory and push it on the stack:
pushd {{path\to\directory}}
rd
This command is an alias of rmdir
.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/rd.
- View documentation for the original command:
tldr rmdir
msg
Send a message to a specific user or session. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/msg.
-
Send a message to a specified user or session:
msg {{username|session_name|session_id}} {{message}}
-
Send a message from
stdin
:
echo "{{message}}" | msg {{username|session_name|session_id}}
-
Send a message to a specific server:
msg /server:{{server_name}} {{username|session_name|session_id}}
-
Send a message to all users of the current machine:
msg *
-
Set a delay in seconds for a message:
msg /time:{{10}}
mkdir
Creates a directory. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/mkdir.
-
Create a directory:
mkdir {{path\to\directory}}
-
Create a nested directory tree recursively:
mkdir {{path\to\sub_directory}}
choco outdated
Check for outdated packages with Chocolatey. More information: https://chocolatey.org/docs/commands-outdated.
-
Display a list of outdated packages in table format:
choco outdated
-
Ignore pinned packages in the output:
choco outdated --ignore-pinned
-
Specify a custom source to check packages from:
choco outdated --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco outdated --user {{username}} --password {{password}}
exit
Quit the current CMD instance or the current batch file. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/exit.
-
Quit the current CMD instance:
exit
-
Quit the current batch script:
exit /b
-
Quit using a specific exit code:
exit {{2}}
scoop
The Scoop package manager. More information: https://scoop.sh.
-
Install a package:
scoop install {{package}}
-
Remove a package:
scoop uninstall {{package}}
-
Update all installed packages:
scoop update --all
-
List installed packages:
scoop list
-
Display information about a package:
scoop info {{package}}
-
Search for a package:
scoop search {{package}}
-
Remove old versions of all packages and clear the download cache:
scoop cleanup --cache --all
net
System utility to view and modify network-related settings. More information: https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/gg651155(v=ws.11).
-
Start or stop a Windows service synchronously:
net {{start|stop}} {{service}}
-
Make sure an SMB share is available in the current console:
net use {{\\smb_shared_folder}} /USER:{{username}}
-
Show the folders currently shared over SMB:
net share
-
Show who is using your SMB shares (run in elevated console):
net session
-
Show users in a local security group:
net localgroup "{{Administrators}}"
-
Add a user to the local security group (run in elevated console):
net localgroup "{{Administrators}}" {{username}} /add
-
Display help for a subcommand:
net help {{subcommand}}
-
Display help:
net help
fondue
Install optional Windows features. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/fondue.
-
Enable a specific Windows feature:
fondue /enable-feature:{{feature}}
-
Hide all output messages to the user:
fondue /enable-feature:{{feature}} /hide-ux:all
-
Specify a caller process name for error reporting:
fondue /enable-feature:{{feature}} /caller-name:{{name}}
iscc
Compiler for Inno Setup installers. It compiles an Inno Setup scripts into an Windows installer executable. More information: https://jrsoftware.org/isinfo.php.
-
Compile an Inno Setup script:
iscc {{path\to\file.iss}}
-
Quietly compile an Inno Setup installer:
iscc /Q {{path\to\file.iss}}
-
Compile a signed Inno Setup installer:
iscc /S={{name}}={{command}} {{path\to\file.iss}}
scoop bucket
Manage buckets: Git repositories containing files which describe how scoop installs applications. If Scoop doesn't know where the bucket is located its repository location must be specified. More information: https://github.com/lukesampson/scoop/wiki/Buckets.
-
List all buckets currently in use:
scoop bucket list
-
List all known buckets:
scoop bucket known
-
Add a known bucket by its name:
scoop bucket add {{name}}
-
Add an unknown bucket by its name and Git repository URL:
scoop bucket add {{name}} {{https://example.com/repository.git}}
-
Remove a bucket by its name:
scoop bucket rm {{name}}
choco feature
Interact with features with Chocolatey. More information: https://chocolatey.org/docs/commands-feature.
-
Display a list of available features:
choco feature list
-
Enable a feature:
choco feature enable --name {{name}}
-
Disable a feature:
choco feature disable --name {{name}}
robocopy
Robust File and Folder Copy. By default files will only be copied if the source and destination have different time stamps or different file sizes. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/robocopy.
-
Copy all
.jpg
and.bmp
files from one directory to another:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} {{*.jpg}} {{*.bmp}}
-
Copy all files and subdirectories, including empty ones:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /E
-
Mirror/Sync a directory, deleting anything not in source and include all attributes and permissions:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /MIR /COPYALL
-
Copy all files and subdirectories, excluding source files that are older than destination files:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /E /XO
-
List all files 50 MB or larger instead of copying them:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /MIN:{{52428800}} /L
-
Allow resuming if network connection is lost and limit retries to 5 and wait time to 15 sec:
robocopy {{path\to\source_directory}} {{path\to\destination_directory}} /Z /R:5 /W:15
-
Display detailed usage information:
robocopy /?
wmic
Interactive shell for detailed information about running processes. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/wmic.
-
Fundamental grammar:
wmic {{alias}} {{where_clause}} {{verb_clause}}
-
Show brief details about the currently running processes:
wmic process list brief
-
Show full details about the currently running processes:
wmic process list full
-
Access specific fields such as process name, process ID and parent process ID:
wmic process get {{name,processid,parentprocessid}}
-
Display information about a specific process:
wmic process where {{name="example.exe"}} list full
-
Display specific fields for a specific process:
wmic process where processid={{pid}} get {{name,commandline}}
-
Kill a process:
wmic process {{pid}} delete
tracert
Receive information about each step in the route between your PC and the target. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/tracert.
-
Trace a route:
tracert {{IP}}
-
Prevent
tracert
from resolving IP addresses to hostnames:
tracert /d {{IP}}
-
Force
tracert
to use IPv4 only:
tracert /4 {{IP}}
-
Force
tracert
to use IPv6 only:
tracert /6 {{IP}}
-
Specify the maximum number of hops in the search for the target:
tracert /h {{max_hops}} {{IP}}
-
Display help:
tracert /?
more
Display paginated output from stdin
or a file.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/more.
-
Display paginated output from
stdin
:
{{echo test}} | more
-
Display paginated output from one or more files:
more {{path\to\file}}
-
Convert tabs to the specified number of spaces:
more {{path\to\file}} /t{{spaces}}
-
Clear the screen before displaying the page:
more {{path\to\file}} /c
-
Display the output starting at line 5:
more {{path\to\file}} +{{5}}
-
Enable extended interactive mode (see help for usage):
more {{path\to\file}} /e
-
Display full usage information:
more /?
rdpsign
A tool for signing Remote Desktop Protocol (RDP) files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/rdpsign.
-
Sign an RDP file:
rdpsign {{path\to\file.rdp}}
-
Sign an RDP file using a specific sha256 hash:
rdpsign {{path\to\file.rdp}} /sha265 {{hash}}
-
Enable quiet output:
rdpsign {{path\to\file.rdp}} /q
-
Display verbose warnings, messages and statuses:
rdpsign {{path\to\file.rdp}} /v
-
Test the signing by displaying the output to
stdout
without updating the file:
rdpsign {{path\to\file.rdp}} /l
rmdir
Remove a directory and its contents. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/rmdir.
-
Remove an empty directory:
rmdir {{path\to\directory}}
-
Remove a directory and its contents recursively:
rmdir {{path\to\directory}} /s
-
Remove a directory and its contents recursively without prompting:
rmdir {{path\to\directory}} /s /q
Print a text file to a printer. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/print.
-
Print a text file to the default printer:
print {{path\to\file}}
-
Print a text file to a specific printer:
print /d:{{printer}} {{path\to\file}}
nvm
Install, uninstall, or switch between Node.js versions. Supports version numbers like "12.8" or "v16.13.1", and labels like "stable", "system", etc. More information: https://github.com/coreybutler/nvm-windows.
-
Install a specific version of Node.js:
nvm install {{node_version}}
-
Set the default version of Node.js (must be run as Administrator):
nvm use {{node_version}}
-
List all available Node.js versions and highlight the default one:
nvm list
-
List all remote Node.js versions:
nvm ls-remote
-
Uninstall a given Node.js version:
nvm uninstall {{node_version}}
azcopy
A file transfer tool for uploading to Azure Cloud Storage Accounts. More information: https://learn.microsoft.com/azure/storage/common/storage-use-azcopy-v10.
-
Log in to an Azure Tenant:
azopy login
-
Upload a local file:
azcopy copy '{{path\to\source_file}}' 'https://{{storage_account_name}}.blob.core.windows.net/{{container_name}}/{{blob_name}}'
-
Upload files with
.txt
and.jpg
extensions:
azcopy copy '{{path\to\source_directory}}' 'https://{{storage_account_name}}.blob.core.windows.net/{{container_name}}' --include-pattern '{{*.txt;*.jpg}}'
-
Copy a container directly between two Azure storage accounts:
azcopy copy 'https://{{source_storage_account_name}}.blob.core.windows.net/{{container_name}}' 'https://{{destination_storage_account_name}}.blob.core.windows.net/{{container_name}}'
-
Synchronize a local directory and delete files in the destination if they no longer exist in the source:
azcopy sync '{{path\to\source_directory}}' 'https://{{storage_account_name}}.blob.core.windows.net/{{container_name}}' --recursive --delete-destination=true
-
Display detailed usage information:
azcopy --help
color
Set the console foreground and background colors. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/color.
-
Set the console colors to the default values:
color
-
List available color values and detailed information:
color /?
-
Set the console foreground and background to a specific color using hexadecimal numbers (
1-9,a-f
):
color {{foreground_code}}{{background_code}}
comp
Compare the contents of two files or sets of files. Use wildcards (*) to compare sets of files. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/comp.
-
Compare files interactively:
comp
-
Compare two specified files:
comp {{path\to\file1}} {{path\to\file2}}
-
Compare two sets of files:
comp {{path\to\directory1}}\* {{path\to\directory2}}\*
-
Display differences in decimal format:
comp /d {{path\to\file1}} {{path\to\file2}}
-
Display differences in ASCII format:
comp /a {{path\to\file1}} {{path\to\file2}}
-
Display line numbers for differences:
comp /l {{path\to\file1}} {{path\to\file2}}
-
Compare files case-insensitively:
comp /c {{path\to\file1}} {{path\to\file2}}
-
Compare only the first 5 lines of each file:
comp /n={{5}} {{path\to\file1}} {{path\to\file2}}
w32tm
Query and control the w32time time synchronization service. More information: https://learn.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings.
-
Show the current status of time synchronization:
w32tm /query /status /verbose
-
Show a time offset graph against a time server:
w32tm /stripchart /computer:{{time_server}}
-
Show an NTP reply from a time server:
w32tm /stripchart /packetinfo /samples:1 /computer:{{time_server}}
-
Show the state of the currently used time servers:
w32tm /query /peers
-
Show configuration of the w32time service (run in elevated console):
w32tm /query /configuration
-
Force time resynchronization immediately (run in elevated console):
w32tm /resync /force
-
Write w32time debug logs into a file (run in elevated console):
w32tm /debug /enable /file:{{path\to\debug.log}} /size:{{10000000}} /entries:{{0-300}}
Set-Acl
Changes the security descriptor of a specified item, such as a file or a registry key. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.security/set-acl.
-
Copy a security descriptor from one file to another:
$OriginAcl = Get-Acl -Path {{path\to\file}}; Set-Acl -Path {{path\to\file}} -AclObject $OriginAcl
-
Use the pipeline operator to pass a descriptor:
Get-Acl -Path {{path\to\file}} | Set-Acl -Path {{path\to\file}}
Start-Service
Starts one or more stopped services. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/start-service.
-
Start a service by using its name:
Start-Service -Name {{service_name}}
-
Display information without starting a service:
Start-Service -DisplayName *{{name}}* -WhatIf
-
Start a disabled service:
Set-Service {{service_name}} -StartupType {{manual}}; Start-Service {{service_name}}
reg delete
Delete keys or their values from the registry. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-delete.
-
Delete a specific registry key:
reg delete {{key_name}}
-
Delete a value under a specific key:
reg delete {{key_name}} /v {{value}}
-
Delete all values recursively under the specified key:
reg delete {{key_name}} /va
-
Forcefully delete all values recursively under a key without a prompt:
reg delete {{key_name}} /f /va
mklink
Create symbolic links. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/mklink.
-
Create a symbolic link to a file:
mklink {{path\to\link_file}} {{path\to\source_file}}
-
Create a symbolic link to a directory:
mklink /d {{path\to\link_file}} {{path\to\source_directory}}
-
Create a hard link to a file:
mklink /h {{path\to\link_file}} {{path\to\source_file}}
-
Create a directory junction:
mklink /j {{path\to\link_file}} {{path\to\source_file}}
reg query
Display the values of keys and sub keys in the registry. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-query.
-
Display all values of a key:
reg query {{key_name}}
-
Display a specific value of a key:
reg query {{key_name}} /v {{value}}
-
Display all values of a key and its sub keys:
reg query {{key_name}} /s
-
Search for keys and values matching a specific pattern:
reg query {{key_name}} /f "{{query_pattern}}"
-
Display a value of a key matching a specified data type:
reg query {{key_name}} /t {{type}}
Wait-Process
Waits for the processes to be stopped before accepting more input. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/wait-process.
-
Stop a process and wait:
Stop-Process -Id {{process_id}}; Wait-Process -Id {{process_id}}
-
Wait for processes for a specified time:
Wait-Process -Name {{process_name}} -Timeout {{30}}
reg unload
Remove data from the registry that was loaded using the reg load
command.
More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-unload.
- Remove data from the registry for a specified key:
reg unload {{key_name}}
choco
The Chocolatey package manager.
Some subcommands such as choco install
have their own usage documentation.
More information: https://chocolatey.org.
-
Execute a Chocolatey command:
choco {{command}}
-
Call general help:
choco -?
-
Call help on a specific command:
choco {{command}} -?
-
Check the Chocolatey version:
choco --version
choco info
Display detailed information about a package with Chocolatey. More information: https://chocolatey.org/docs/commands-info.
-
Display information on a specific package:
choco info {{package}}
-
Display information for a local package only:
choco info {{package}} --local-only
-
Specify a custom source to receive packages information from:
choco info {{package}} --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco info {{package}} --user {{username}} --password {{password}}
vol
Display information about volumes. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/vol.
-
Display the label and serial number for the current drive:
vol
-
Display the label and serial number for a specific volume:
vol {{D:}}
Test-Json
Tests whether a string is a valid JSON document. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/test-json.
-
Test if a string from
stdin
is in JSON format:
'{{string}}' | Test-Json
-
Test if a string JSON format:
Test-Json -Json '{{json_to_test}}'
-
Test if a string from
stdin
matches a specific schema file:
'{{string}}' | Test-Json -SchemaFile {{path\to\schema_file.json}}
assoc
Display or change associations between file extensions and file types. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/assoc.
-
List all associations between file extensions and file types:
assoc
-
Display the associated file type for a specific extension:
assoc {{.txt}}
-
Set the associated file type for a specific extension:
assoc .{{txt}}={{txtfile}}
-
View the output of
assoc
one screen at a time:
assoc | {{more}}
diskpart
Disk, volume and partition manager. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/diskpart.
-
Run diskpart by itself in an administrative command prompt to enter its command-line:
diskpart
-
List all disks:
list disk
-
Select a volume:
select volume {{volume}}
-
Assign a drive letter to the selected volume:
assign letter {{letter}}
-
Create a new partition:
create partition primary
-
Activate the selected volume:
active
-
Exit diskpart:
exit
uwfmgr
Unified Write Filter (UWF). Protect drives by redirecting any writes to the drive to a virtual overlay. Writes are discarded upon reboot unless committed by default. More information: https://learn.microsoft.com/en-us/windows/iot/iot-enterprise/customize/unified-write-filter.
-
Get the current status:
uwfmgr get-config
-
Set a drive as protected:
uwfmgr volume protect {{drive_letter}}:
-
Remove a drive from protection list:
uwfmgr volume unprotect {{drive_letter}}:
-
Enable or disable protection (Applies after reboot):
uwfmgr filter {{enable|disable}}
-
Commit changes of a file on protected drive:
uwfmgr file commit {{drive_letter:\path\to\file}}
-
Commit deletion of a file on protected drive:
uwfmgr file commit-delete {{drive_letter:\path\to\file}}
Out-String
Outputs input objects as a string. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/out-string.
-
Print host information as string:
Get-Alias | Out-String
-
Convert each object to a string rather than concatenating all the objects into a single string:
Get-Alias | Out-String -Stream
-
Use the
Width
parameter to prevent truncation:
@{TestKey = ('x' * 200)} | Out-String -Width {{250}}
eventcreate
Create custom entries in the event log. Event IDs can be any number between 1 and 1000. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/eventcreate.
-
Create a new event with a given ID (1-1000) in the log:
eventcreate /t {{success|error|warning|information}} /id {{id}} /d "{{message}}"
-
Create an event in a specific event log:
eventcreate /l {{log_name}} /t {{type}} /id {{id}} /d "{{message}}"
-
Create an event with a specific source:
eventcreate /so {{source_name}} /t {{type}} /id {{id}} /d "{{message}}"
-
Create an event in a remote machine's event log:
eventcreate /s {{hostname}} /u {{username}} /p {{password}} /t {{type}} /id {{id}} /d "{{message}}"
Set-Service
Starts, stops, and suspends a service, and changes its properties. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.management/set-service.
-
Change a display name:
Set-Service -Name {{hostname}} -DisplayName "{{name}}"
-
Change the startup type of services:
Set-Service -Name {{service_name}} -StartupType {{Automatic}}
-
Change the description of a service:
Set-Service -Name {{service_name}} -Description "{{description}}"
Show-Markdown
Shows a Markdown file or string in the console in a friendly way using VT100 escape sequences or in a browser using HTML. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/show-markdown.
-
Render markdown to console from a file:
Show-Markdown -Path {{path\to\file}}
-
Render markdown to console from string:
{{"# Markdown content"}} | Show-Markdown
-
Open Markdown file in a browser:
Show-Markdown -Path {{path\to\file}} -UseBrowser
if
Performs conditional processing in batch scripts. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/if.
-
Execute the specified commands if the condition is true:
if {{condition}} ({{echo Condition is true}})
-
Execute the specified commands if the condition is false:
if not {{condition}} ({{echo Condition is true}})
-
Execute the first specified commands if the condition is true otherwise execute the second specified commands:
if {{condition}} ({{echo Condition is true}}) else ({{echo Condition is false}})
-
Check whether
%errorlevel%
is greater than or equal to the specified exit code:
if errorlevel {{2}} ({{echo Condition is true}})
-
Check whether two strings are equal:
if %{{variable}}% == {{string}} ({{echo Condition is true}})
-
Check whether two strings are equal without respecting letter case:
if /i %{{variable}}% == {{string}} ({{echo Condition is true}})
-
Check whether a file exist:
if exist {{path\to\file}} ({{echo Condition is true}})
replace
Replace files. See also:robocopy
,move
,copy
, anddel
. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/replace.
-
Replace the destination file with the one from the source directory:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}}
-
Add files to the destination directory instead of replacing existing files:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /a
-
Interactively copy multiple files, with a prompt before replacing or adding a destination file:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /p
-
Replace even read only files:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /r
-
Wait for you to insert a disk before it replaces files (originally to allow inserting a floppy disk):
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /w
-
Replace all files in subdirectories of the destination:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /s
-
Replace only files in the destination directory which are older than the files in the source directory:
replace {{path\to\file_or_directory}} {{path\to\destination_directory}} /u
-
Display detailed usage information:
replace /?
tzutil
A tool for displaying or configuring the system time zone. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/tzutil.
-
Get the current time zone:
tzutil /g
-
Display a list of available time zones:
tzutil /l
-
Set the system time zone to the specific value:
tzutil /s {{timezone_id}}
type
Display the contents of a file. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/type.
- Display the contents of a specific file:
type {{path\to\file}}
Sort-Object
Sorts objects by property values. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/sort-object.
-
Sort the current directory by name:
Get-ChildItem | Sort-Object
-
Sort the current directory by name descending:
Get-ChildItem | Sort-Object -Descending
-
Sort items removing duplicates:
"a", "b", "a" | Sort-Object -Unique
-
Sort the current directory by file length:
Get-ChildItem | Sort-Object -Property Length
-
Sort processes with the highest memory usage based on their working set (WS) size:
Get-Process | Sort-Object -Property WS
reg flags
Display or set flags on registry keys. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/reg-flags.
-
Display current flags for a specific key:
reg flags {{key_name}} query
-
Display help and available flag types:
reg flags /?
-
Set specified space-separated flags, and unset unmentioned flags, for a specific key:
reg flags {{key_name}} set {{flag_names}}
-
Set specified flags for a specific key and its sub keys:
reg flags {{key_name}} set {{flag_names}} /s
Invoke-WebRequest
Performs a HTTP/HTTPS request to the Web. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/invoke-webrequest.
-
Download the contents of a URL to a file:
Invoke-WebRequest {{http://example.com}} -OutFile {{path\to\file}}
-
Send form-encoded data (POST request of type
application/x-www-form-urlencoded
):
Invoke-WebRequest -Method Post -Body @{ name='bob' } {{http://example.com/form}}
-
Send a request with an extra header, using a custom HTTP method:
Invoke-WebRequest -Headers {{@{ X-My-Header = '123' }}} -Method {{PUT}} {{http://example.com}}
-
Send data in JSON format, specifying the appropriate content-type header:
Invoke-WebRequest -Body {{'{"name":"bob"}'}} -ContentType 'application/json' {{http://example.com/users/1234}}
-
Pass a username and password for server authentication:
Invoke-WebRequest -Headers @{ Authorization = "Basic "+ [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes("myusername:mypassword")) } {{http://example.com}}
where
Display the location of files that match the search pattern. Defaults to current work directory and paths in the PATH environment variable. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/where.
-
Display the location of file pattern:
where {{file_pattern}}
-
Display the location of file pattern including file size and date:
where /T {{file_pattern}}
-
Recursively search for file pattern at specified path:
where /R {{path\to\directory}} {{file_pattern}}
-
Silently return the error code for the location of the file pattern:
where /Q {{file_pattern}}
whoami
Display details about the current user. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/whoami.
-
Display the username of the current user:
whoami
-
Display the groups that the current user is a member of:
whoami /groups
-
Display the privileges of the current user:
whoami /priv
-
Display the user principal name (UPN) of the current user:
whoami /upn
-
Display the logon ID of the current user:
whoami /logonid
-
Display all information for the current user:
whoami /all
attrib
Display or change attributes of files or directories. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/attrib.
-
Display all set attributes of files in the current directory:
attrib
-
Display all set attributes of files in a specific directory:
attrib {{path\to\directory}}
-
Display all set attributes of files and [d]irectories in the current directory:
attrib /d
-
Display all set attributes of files in the current directory and [s]ub-directories:
attrib /s
-
Add the
[r]ead-only
or[a]rchive
or[s]ystem
or[h]idden
ornot content [i]ndexed
attribute to files or directories:
attrib +{{r|a|s|h|i}} {{path\to\file_or_directory1 path\to\file_or_directory2 ...}}
-
Remove a specific attribute of files or directories:
attrib -{{r|a|s|h|i}} {{path\to\file_or_directory1 path\to\file_or_directory2 ...}}
Tee-Object
Saves command output in a file or variable and also sends it down the pipeline. This command can only be used through PowerShell. More information: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/tee-object.
-
Output processes to a file and to the console:
Get-Process | Tee-Object -FilePath {{path\to\file}}
-
Output processes to a variable and
Select-Object
:
Get-Process notepad | Tee-Object -Variable {{proc}} | Select-Object processname,handles
winget
Windows Package Manager. More information: https://learn.microsoft.com/windows/package-manager/winget.
-
Install a package:
winget install {{package}}
-
Remove a package (Note:
remove
can also be used instead ofuninstall
):
winget uninstall {{package}}
-
Display information about a package:
winget show {{package}}
-
Search for a package:
winget search {{package}}
-
Upgrade all packages to the latest versions:
winget upgrade --all
-
List all packages installed that can be managed with
winget
:
winget list --source winget
-
Import packages from a file, or export installed packages to a file:
winget {{import|export}} {{--import-file|--output}} {{path/to/file}}
-
Validate manifests before submitting a PR to the winget-pkgs repository:
winget validate {{path/to/manifest}}
choco upgrade
Upgrade one or more packages with Chocolatey. More information: https://chocolatey.org/docs/commands-upgrade.
-
Upgrade one or more space-separated packages:
choco upgrade {{package1 package2 ...}}
-
Upgrade to a specific version of a package:
choco upgrade {{package}} --version {{version}}
-
Upgrade all packages:
choco upgrade all
-
Upgrade all except specified comma-separated packages:
choco upgrade all --except "{{package1 package2 ...}}"
-
Confirm all prompts automatically:
choco upgrade {{package}} --yes
-
Specify a custom source to receive packages from:
choco upgrade {{package}} --source {{source_url|alias}}
-
Provide a username and password for authentication:
choco upgrade {{package}} --user {{username}} --password {{password}}
cmstp
Manage connection service profiles. More information: https://learn.microsoft.com/windows-server/administration/windows-commands/cmstp.
-
Install a specific profile:
cmstp "{{path\to\profile_file}}"
-
Install without creating a desktop shortcut:
cmstp /ns "{{path\to\profile_file}}"
-
Install without checking for dependencies:
cmstp /nf "{{path\to\profile_file}}"
-
Only install for the current user:
cmstp /su "{{path\to\profile_file}}"
-
Install for all users (requires administrator privileges):
cmstp /au "{{path\to\profile_file}}"
-
Install silently without any prompts:
cmstp /s "{{path\to\profile_file}}"
-
Uninstall a specific profile:
cmstp /u "{{path\to\profile_file}}"
-
Uninstall silently without a confirmation prompt:
cmstp /u /s "{{path\to\profile_file}}"
slmgr
This command is an alias of slmgr.vbs
.
More information: https://docs.microsoft.com/windows-server/get-started/activation-slmgr-vbs-options.
- View documentation for the original command:
tldr slmgr.vbs
License and Disclaimer
The content on this page is copyright © 2014—present the tldr-pages team and contributors.This page is used with permission under Creative Commons Attribution 4.0 International License.
While we do attempt to make sure content is accurate, there isn't a warranty of any kind.