답변:
다음 명령을 입력하십시오 :
New-item –type file –force $profile
PowerShell 5 이전 또는 PowerShell 6 Core 용 파일 Microsoft.PowerShell_profile.ps1이 생성됩니다 (이 폴더는 자동으로 생성됨).C:\Users\<username>\Documents\WindowsPowerShell\C:\Users\<username>\Documents\PowerShell\
그런 다음이 파일을 편집하면 개인화 된 PowerShell 기능을 추가하거나 모듈 또는 스냅인을로드 할 수 있습니다.
이제 powershell 콘솔을 실행하면 Microsoft.PowerShell_profile.ps1트리거됩니다.
기본 $ Profile 변수 업데이트 기본 .PS1 파일 편집 (없는 경우 작성) .PS1 파일에 스크립트 추가
이를 수행하는 방법에는 여러 가지가 있습니다. 간단한 방법은 기본 powershell 홈 경로의 프로필 스크립트입니다.
$env:UserProfile\Documents\WindowsPowerShell. C:\Users\<username>\Documents\WindowsPowerShell. profile.ps1. 이 파일에 스크립트를 작성할 수 있으며이 파일은 사용자로 powershell을 시작할 때마다 실행됩니다. 다른 곳에 스크립트가 있으면 profile.ps1해당 스크립트를 호출 할 수 있습니다 .참고로 기본 프로필 이름은이어야합니다 Microsoft.PowerShell_profile.ps1.
그러나 profile.ps1작동합니다.