#title 파워셸 [[TableOfContents]] == 환경 변수에 대해 == PowerShell 환경 변수는 PowerShell 스크립트에서 사용되는 변수이다. PowerShell 환경 변수는 일반적으로 $ 문자로 시작하며, 변수 이름은 대소문자를 구분한다. More: https://docs.microsoft.com/ko-kr/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-7.2 {{{+1 Quick Start }}} 1. 변수 선언: `$` 문자와 변수 이름을 사용한다. `$myVariable = "Hello, World!"` 2. 변수 값 읽기: `$` 문자와 변수 이름을 사용한다. `$myVariable` 3. 변수 값 변경: `$` 문자와 변수 이름을 사용하여 변수에 새 값을 할당한다. `$myVariable = "Goodbye, World!"` 4. 변수 삭제: `Remove-Variable` cmdlet 사용. 예) `Remove-Variable myVariable`과 같이 입력하면 `$myVariable` 변수를 삭제할 수 있다. 시스템 환경 변수: PowerShell은 시스템 환경 변수도 읽고 쓸 수 있다. 시스템 환경 변수는 `$env:` 접두사를 사용하여 접근할 수 있다. 예를 들어, `$env:Path` 변수를 사용하여 시스템 Path 환경 변수 값을 읽을 수 있다. 사용자 환경 변수: 사용자 환경 변수는 `$env:USERNAME`과 같이 `$env:` 접두사를 사용하여 접근할 수 있다. == Tips == === 환경 설정 === ==== Bash-like Tab 키 완성 목록 제시 ==== {{{ > Set-PSReadlineKeyHandler -Chord Tab -Function PossibleCompletions }}} More like https://dev.to/ofhouse/add-a-bash-like-autocomplete-to-your-powershell-4257 Q: PowerShell의 Set-PSReadlineKeyHandler에 대해서 알려줘. [[icon(chatgpt.png)]]ChatGPT: Set-PSReadlineKeyHandler는 PowerShell의 PSReadline 모듈에서 사용되는 cmdlet입니다. 이 cmdlet은 키보드 입력과 PSReadline 명령을 매핑하는 데 사용됩니다. PSReadline 모듈은 PowerShell에서 명령줄 편집을 지원하는 모듈이며, 사용자 정의 키 매핑을 만들 수 있는 기능도 제공합니다. Set-PSReadlineKeyHandler cmdlet을 사용하여 이러한 사용자 정의 키 매핑을 만들 수 있습니다. 예를 들어, `Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete`와 같이 입력하면 Tab 키가 MenuComplete 함수와 매핑됩니다. 이렇게 매핑된 키를 누르면 MenuComplete 함수가 실행되어 자동 완성을 제공합니다. 또한, Set-PSReadlineKeyHandler cmdlet은 키 매핑을 변경하거나 삭제할 수도 있습니다. 예를 들어, `Remove-PSReadlineKeyHandler -Key Tab`와 같이 입력하면 Tab 키와 관련된 모든 매핑을 삭제할 수 있습니다. Set-PSReadlineKeyHandler cmdlet은 PowerShell 스크립트에서 매우 유용한 기능이며, 사용자 정의 키 매핑을 만들어 PowerShell 명령줄 편집을 개선할 수 있습니다. ---- CategoryDocument