Windows

[batch] 스크립트 파일 위치 확인하는 방법

어발 2023. 8. 29. 15:41

batch 파일을 실행할때, 실행한 batch파일의 경로를 다양하게 획득하는 방법

배치파일의 경로가 "C:\User\Path\test.bat" 일경우

명령어 의미 결과
%0 파일 전체 경로 C:\User\Paht\test.bat
%~d0 드라이브 명 C:
%~p0 경로 \User\Path\
%~n0 파일명 test
%~x0 확장자 명 .bat
%~dp0 드라이브와 경로 C:\User\Path\
728x90