사용자 정의 함수에서 Get-ChildItem
함수를 호출하려고합니다. 문제는 함수에 대한 인수가 동적 일 수 있다는 것입니다.Powershell에서 문자열로 인수를 사용하여 함수 호출
function Test {
Get-ChildItem $Args
}
내가
Test .\ //this works as Path is taken as default argument value
Test .\ -Force //this doesn't work as expected as it still tries to consider entire thing as Path
Test -Path .\ -Force //same error
방법 wrap around function
및 pass the arguments as it's
를 시도?
은'은 Get-ChildItem을 @ Args' – PetSerAl
@PetSerAl Waaay IEX 해킹보다 더, 나는 하나의 배열을 플랫 수 있다는 것을 잊었습니다. 대답이어야합니다. – beatcracker
@PetSerAl, 답변을 게시 할 수 있습니까? 나는 이것이 IEX보다 낫다고 믿는다. IEX는'space separated arguments'를 지원하지 않습니다. 이것은 모든 것을 지원한다. – Reddy