2013-04-12 5 views

답변

3

왜 안 :

test-path c:\myfolder\lab* -pathtype leaf #leaf is for file (get-help test-path -full) 
+0

가 어떻게 foreach는 함께 사용할 수 있습니까? "lab *"로 시작하는 foreach 파일은 true를 반환합니다. 문자열의 비교에 문제가 있습니다. – rschirin

+0

@rschirin 오류를주는 모든 세부 사항 및 코드와 함께 새로운 질문을 게시하십시오. 감사! –

1
$files = Get-ChildItem 'LAB*' 
if ($files) { 
    Write-Host "Found one." 
} 
else { 
    Write-Host "Not there." 
} 

이 경우 Get-ChildItem은 일치하는 파일의 목록을 반환합니다. 그 목록은 "진리"에 대해 평가 될 수 있습니다.

관련 문제