2017-10-05 1 views
1

I 다음 스크립트가 있습니다숨기기 PowerShell을 출력

PARAM ([매개 변수 (필수 = $ TRUE)] [문자열] $ 이명 령)

New-Item -force -path "$dest\1\" -itemtype directory 
New-Item -force -path "$dest\2\" -itemtype directory 
New-Item -force -path "$dest\3\" -itemtype directory 

Copy-Item -path "C:\Development\1\bin\Debug\*" -destination "$dest\1\" -container -recurse -force 
Copy-Item -path "C:\Development\2\bin\Debug\*" -destination "$dest\2\" -container -recurse -force 
Copy-Item -path "C:\Development\3\bin\Debug\*" -destination "$dest\3\" -container -recurse -force 

스크립트 문자열 복사 모든 파일을 소요하고 폴더를 정적 출처 경로에서 지정된 루트 문자열로 이동하여 구조 명확성을 위해 일부 폴더를 수정합니다.

잘 작동하지만 "New-Item"명령의 결과를 인쇄하므로 숨길 수 있습니다. 나는 SE에 그물 및 다른 질문을 보았다. 그러나 나의 문제에 대한 결정적인 대답은 발견되지 않았다.

궁금한 경우 - 대상 폴더가없는 경우 PS '-recurse 매개 변수의 결함을 우회하여 모든 하위 폴더를 올바르게 복사하지 못하게하려면 처음에 "New-item"을 사용하고 있습니다. 중 - Null로

+0

가능한 복제 (즉 그들이 필수) PowerShell에서 출력을 무시하는 더 나은 (청소기) 방법은 무엇입니까? (https://stackoverflow.com/questions/5260125/whats-the-better-cleaner-way-to-ignore-powershell에서 출력) – PrestonM

답변

1

파이프를

New-Item -Path c:\temp\foo -ItemType Directory | Out-Null 
Test-Path c:\temp\foo