PowerShell 관리자 권한
A terminal window opens. To enable WSL, you need to run powershell as an administrator. So in your powershell terminal, type:
1 | > Start-Process powershell -Verb runAs |
1 | > start cmd -v runAs |
Powershell 다중라인 명령어
명령을 이어서 붙일 때 backtick character ` 를 사용한다.
1 | &"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe" ` |
how-to-split-long-commands-over-multiple-lines-in-powershell
Commands
ss1-1
driverquery – Lists All Installed Drivers
It is important to have access to all drivers because they often cause problems.
That’s what this command does – it shows you even the drivers you won’t find in the device manager.
ss2-1
chdir or cd – Changes the Current Working Directory to the Specified Directory
ss3-1
systeminfo – Shows Your PC’s Details
If you want to see more detailed information about your system you won’t see in the GUI, this is the command for you.
ss4-1
set – Shows your PC’s Environment Variables
ss5-2
prompt – Changes the Default Text Shown before Entering Commands
By default, the command prompt shows the C drive path to your user account.
You can use the prompt command to change that default text with the syntax prompt prompt_name $G:
ss6-1
N.B: If you don’t append $G to the command, you won’t get the greater than symbol in front of the text.
clip – Copies an Item to the Clipboard
For example, dir | clip copies all the content of the present working directory to the clipboard.
ss7
You can type clip /? and hit ENTER to see how to use it.
assoc – Lists Programs and the Extensions They are Associated With
ss8
title – Changes the Command Prompt Window Title Using the Format title window-title-name
ss9
fc – Compares Two Similar Files
If you are a programmer or writer and you want to quickly see what differs between two files, you can enter this command and then the full path to the two files. For example fc “file-1-path” “file-2-path”.
ss10
cipher – Wipes Free Space and Encrypts Data
On a PC, deleted files remain accessible to you and other users. So, technically, they are not deleted under the hood.
You can use the cipher command to wipe the drive clean and encrypt such files.
ss11
netstat -an – Shows Open Ports, their IP Addresses and States
ss12
ping – Shows a Website IP Address, Lets you Know How Long it Takes to Transmit Data and a Get Response
ss13
color – Changes the Text Color of the Command Prompt
Enter color attr to see the colors you can change to:
ss14
Entering color 2 changes the color of the terminal to green:
ss15
for /f “skip=9 tokens=1,2 delims=:” %i in (‘netsh wlan show profiles’) do @echo %j | findstr -i -v echo | netsh wlan show profiles %j key=clear – Shows All Wi-Fi Passwords
ss16
ipconfig – Shows Information about PC IP Addresses and Connections
ss17
This command also has extensions such as ipconfig /release, ipconfig /renew, and ipconfig /flushdns which you can use to troubleshoot issues with internet connections.
sfc – System File Checker
This command scans your computer for corrupt files and repairs them. The extension of the command you can use to run a scan is /scannow.
ss18
powercfg – Controls Configurable Power Settings
You can use this command with its several extensions to show information about the power state of your PC.
You can enter powercfg help to show those extensions.
ss19
For example, you can use powercfg /energy to generate a battery health report.
ss20
The powercfg /energy command will generate an HTML file containing the report. You can find the HTML file in C:\Windows\system32\energy-report.html.
dir – Lists Items in a Directory
ss21
del – Deletes a File
ss22
attrib +h +s +r folder_name – Hides a Folder
You can hide a folder right from the command line by typing in attrib +h +s +r folder_name and then pressing ENTER.
To show the folder again, execute the command – attrib -h -s -r folder_name.
ss23
start website-address – Logs on to a Website from the Command Line
ss24
ss25
tree – Shows the Tree of the Current Directory or Specified Drive
ss26
ver – Shows the Version of the OS
ss27
tasklist – Shows Open Programs
You can do the same thing you do with the task manager with this command:
ss28
The next command shows you how to close an open task.
taskkill – Terminates a Running Task
To kill a task, run taskkill /IM “task.exe” /F. For example, taskkill /IM “chrome.exe” /F:
ss29
date – Shows and Changes the Current Date
ss30
time – Shows and Changes the Current Time
ss31
vol – Shows the Serial Number and Label Info of the Current Drive
ss32
dism – Runs the Deployment Image Service Management Tool
ss33
CTRL + C – Stops the Execution of a Command
-help – Provides a Guide to other Commands
For example, powercfg -help shows how to use the powercfg command
ss34
echo – Shows Custom Messages or Messages from a Script or File
ss35
You can also use the echo command to create a file with this syntax echo file-content > filename.extension.
ss36
mkdir – Creates a Folder
ss37
rmdir – Deletes a Folder
ss38
N.B.: The folder must be empty for this command to work.
more – Shows More Information or the Content of a File
ss39
move – Moves a File or Folder to a Specified Folder
ss40
ren – Renames a File with the Syntax ren filename.extension new-name.extension
ss41-1
cls – Clears the Command Line
In case you enter several commands and the command line gets clogged up, you can use cls to clear all entries and their outputs.
cls
exit – Closes the Command Line
shutdown – Shuts down, Restarts, Hibernates, Sleeps the Computer
You can shut down, restart, hibernate, and sleep your PC from the command line.
Enter shutdown in the command line so you can see the extensions you can use to perform the actions. For example, shutdown /r will restart your computer.