- 복사
# 복사
Copy D:\test1.txt D:\test2.txt
# 강제 복사 (읽기 속성이 있는 경우)
Copy D:\test1.txt D:\test2.txt -Force
# 폴더 복사
Copy D:\folder1 D:\folder2
# 폴더내 파일까지 복사(폴더 하위 폴더 파일은 제외)
Copy D:\folder1\* D:\folder2
# 폴더 전체 복사
Copy D:\folder1 D:\folder2 -Recurse
Copy-Item (Microsoft.PowerShell.Management)
The Copy-Item cmdlet copies an item from one location to another location in the same namespace. For instance, it can copy a file to a folder, but it cannot copy a file to a certificate drive. This cmdlet does not cut or delete the items being copied. The
docs.microsoft.com
- 삭제
# 삭제
RD D:\folder1
# 강제 삭제 (읽기 전용 속성이 있는 경우)
RD D:\folder1 -Force
# 내부까지 삭제
RD D:\folder1 -Recurse
Remove-Item (Microsoft.PowerShell.Management)
The Remove-Item cmdlet deletes one or more items. Because it is supported by many providers, it can delete many different types of items, including files, folders, registry keys, variables, aliases, and functions.
docs.microsoft.com
- 이동
# 이동
MV D:\folder1 D:\folder2
Move-Item (Microsoft.PowerShell.Management)
The Move-Item cmdlet moves an item, including its properties, contents, and child items, from one location to another location. The locations must be supported by the same provider. For example, it can move a file or subdirectory from one directory to anot
docs.microsoft.com
- 공통 옵션
-
-Force : 파일/폴더에 읽기 속성이 있는 경우 강제로 명령어 실행
-
-Recurse : 재귀를 통해 지정된 폴더 내부 모두를 복사/삭제/이동 처리
-
-PassThru : 명령을 수행한 결과값 출력 (RD에서는 없음)
'Windows 10 > PowerShell' 카테고리의 다른 글
PowerShell : Date (0) | 2019.06.15 |
---|---|
PowerShell : IEX (문자열을 명령어로 실행하기) (0) | 2019.06.15 |
PowerSehll : Try, Catch, Finally (예외 처리) (0) | 2019.06.14 |
PowerShell : Array, 동적 배열 (0) | 2019.06.14 |
PowerShell : Switch (0) | 2019.06.14 |