PowerShell

PowerShell 폴더와 파일 생성

delmaster 2016. 2. 25. 09:00

파워쉘에서 폴더와 파일을 만들기 위해서는 아래의 통합된 명령을 사용할 수 있습니다.

 New-Item -Path <생성될 개체이름을 포함한 전체 경로> <ItemType <"directory | file"> [-value <"파일일 경우, 파일에 기록할 내용">]


C드라이브에 test.txt 파일 생성 예제

New-Item -Path c:\test.txt -ItemType file


C드라이브에 test1파일과 test2 파일 생성하기

New-Item -path c:\test1, c:\test2 -ItemType file


C드라이브에 test3.txt 파일 생성하며 내부에 "Test File" 기록

New-Item -Path c:\test3.txt -ItemType file -Value "Test File"


C드라이브에 test4 폴더 생성

New-Item -Path c:\test4 -ItemType directory


C드라이브에 test5, test6 폴더 생성하기

New-Item -Path c:\test5, c:\test6 -ItemType directory


C드라이브에 test8 폴더를 생성하고 test8폴더 내부에 test9, test9 폴더 내부에 test10 폴더 연속으로 생성

New-Item -Path c:\test8\9\10 -ItemType directory

'PowerShell' 카테고리의 다른 글

PowerShell 변수 사용  (0) 2016.02.29
PowerShell 리디렉션 출력  (0) 2016.02.26
PowerShell 필터링 기능  (0) 2016.02.26
PowerShell 비교 연산자  (0) 2016.02.25
PowerShell 명령어 실행결과확인 또는 실행승인  (0) 2016.02.25
PowerShell Alias  (0) 2016.02.24
PowerShell 도움말 업데이트  (0) 2016.02.24
PowerShell 버전 확인  (0) 2016.02.24