사용자 도구

사이트 도구


windows:powershell

문서의 이전 판입니다!


Windows Powershell

기본 개인 profile 파일

  • $PROFILE 환경변수값
  • $Home\[My ]Documents\WindowsPowerShell\Profile.ps1

Powershell Core

sudo

Color ls

  • PowerShell Gallary 로 설치
  • $Home\[My ]Documents\WindowsPowerShell\Profile.ps1에 다음 추가하면 l, ls로 명령실행가능. 기존 명령은 dir로 가능
    # for colored ls
    Import-Module Get-ChildItemColor
    
    Set-Alias l Get-ChildItemColor -option AllScope
    Set-Alias ls Get-ChildItemColorFormatWide -option AllScope

명령창 없이 명령 실행하기

powershell start-process '원하는명령(혹은 .bat)' -WindowStyle Hidden

Consoles

process 목록

ps *foo*
get-process | findstr foo
get-process | where ProcessName -like "*foo*"

환경변수 Environment Variable

#값 읽기
$Env:<variable-name>
$Env:PATH

# 값 지정
$Env:<variable-name> = "<new-value>"

$Env:path = $env:path + ";c:\temp"
Set-Item -Path Env:Path -Value ($Env:Path + ";C:\Temp")

기본명령

  • 디렉토리 삭제
    Remove-Item [dirname] -Force
  • Symoblic Link
    # 관리자 권한 필요
    New-Item -ItemType SymbolicLink -Name MySymLinkFile.txt -Target $pshome\profile.ps1
    New-Item -ItemType SymbolicLink -Path C:\Temp\MySymLinkFile.txt -Value $pshome\profile.ps1

참조

windows/powershell.1528198924.txt.gz · 마지막으로 수정됨: 2018/06/05 20:42 저자 kwon37xi