%EB%8A%94%20%EB%AC%B4%EC%97%87%EC%9E%85%EB%8B%88%EA%B9%8C%3F.png)
경로를 입력하여 명령을 시도하고 있었는데 를 쳤을 때 TAB이런 일이 일어났습니다.
C:\> C:\Program Files\KeePassXC\keepass<TAB>
# became this:
C:\> & 'C:\Program Files\KeePassXC\keepassxc-cli.exe'
단순히 문자열을 평가합니까? 적어도 경로에 공백이 있기 때문에 경로를 따옴표로 묶어야 하며 그렇지 않으면 &
다음 오류가 발생한다고 가정합니다.
C:\> 'C:\Program Files\KeePassXC\keepassxc-cli.exe' --help
At line:1 char:50
+ 'C:\Program Files\KeePassXC\keepassxc-cli.exe' --help
+ ~~~~
Unexpected token 'help' in expression or statement.
At line:1 char:1
+ 'C:\Program Files\KeePassXC\keepassxc-cli.exe' --help
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The '--' operator works only on variables or on properties.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
문서에 링크를 걸어주실 수 있나요? 감사합니다!
답변1
그것은 호출 또는 호출 연산자입니다.통화 교환원 &:
호출 연산자를 사용하여 파일 이름을 사용하여 스크립트를 실행할 수 있습니다. 아래 예에서는 공백이 포함된 스크립트 파일 이름을 보여줍니다. 스크립트를 실행하려고 하면 PowerShell은 대신 파일 이름이 포함된 인용 문자열의 내용을 표시합니다. 호출 연산자를 사용하면 파일 이름이 포함된 문자열의 내용을 실행할 수 있습니다.
PS C:\Scripts> ".\script name with spaces.ps1" .\script name with spaces.ps1 PS C:\Scripts> & ".\script name with spaces.ps1" Hello World!