Skip to main content

Windows Command Prompt

warning

This document has been translated using machine translation without human review.

How to open Command Prompt in any folder?​

Simply type cmd in the Explorer address bar:

cmd

If you hold the Shift key and right-click anywhere, you can launch PowerShell:

PowerShell

How to set an environment variable? (only for current session)​

set VAR_NAME=VALUE

How to get the hostname of the current machine?​

hostname
Syntax
mklink LINK_PATH TARGET_PATH
Example
mklink  "C:\Program Files\nodejs" "C:\nvm\v18.16.0" 

How to view the current DNS cache?​

View cache
ipconfig /displaydns
Clear cache
ipconfig /flushdns

How to find all substrings in command output?​

dir | findstr git

How to launch Windows Event Log?​

eventvwr

How to check if a specific port is occupied?​

netstat -na | find "8080"

How to restart a service?​

net stop nginx && net start nginx