#TIL #batch path를 디렉토리와 파일로 분리하기

C:\>FOR %A in ("C:\Users\ohyecloudy\test folder\test.txt") DO @ECHO %~dpA
C:\Users\ohyecloudy\test folder\
C:\>FOR %A in ("C:\Users\ohyecloudy\test folder\test.txt") DO @ECHO %~nxA
test.txt

배치 스크립트(batch script) 안에서는 % 문자를 두 개 사용.

%~dp1 Expand %1 to a drive letter and path only
%~nx2 Expand %2 to a file name and extension only

parameter extensions로 지원한다.

참고

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post