2014년 2월 2일 일요일

win7에서 배치파일 현재 폴더 수정

When you run a batch file as administrator under windows vista and 7 the current directory gets set to C:\windows\system32. This can prevent your scripts from working correctly if you use relative paths.

To fix this problem, include these two lines at the top of your .bat script:
 
@setlocal enableextensions
@cd /d "%~dp0"

This will change the current directory to the location of the .bat file.

댓글 없음: