문서의 이전 판입니다!
$PROFILE
환경변수 값으로 프로필 파일 생성New-Item $profile -force -itemtype file
$Home\[My ]Documents\WindowsPowerShell\Profile.ps1
$Home\[My ]Documents\WindowsPowerShell\Profile.ps1
에 다음 추가하면 l
, ls
로 명령실행가능. 기존 명령은 dir
로 가능# for colored ls Import-Module Get-ChildItemColor Set-Alias ls Get-ChildItemColor -option AllScope Set-Alias ll Get-ChildItemColorFormatWide -option AllScope
powershell start-process '원하는명령(혹은 .bat)' -WindowStyle Hidden
ps *foo* get-process | findstr foo get-process | where ProcessName -like "*foo*"
#값 읽기 $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
# 관리자 권한 필요 New-Item -ItemType SymbolicLink -Name MySymLinkFile.txt -Target $pshome\profile.ps1 New-Item -ItemType SymbolicLink -Path C:\Temp\MySymLinkFile.txt -Value $pshome\profile.ps1
# 문자열 filter "Hello","HELLO" | Select-String -Pattern "HELLO" -CaseSensitive # *.xml 파일들에서 문자열 탐색 Select-String -Path "*.xml" -Pattern "the the" # 매칭이 안되는 부분 찾기 Select-String -Path "process.txt" -Pattern "idle, svchost" -NotMatch
Rename-Item -Path old_name -NewName new_name [-Force]
cinst curl
로 설치하고$profile
파일에 PowerShell에 자체 curl
alias를 지워야 실제 curl
명령이 실행된다.remove-item alias:curl
# vi 를 vim.exe 실행하는 것으로 alias 걸기 set-alias -name vi -value vim.exe