배치 파일 생성

배치 파일 생성

배치 파일 코드에 다음 코드를 작성했습니다.

if not exist "C:\Windows\Temp\web.config.hints.cancer.gov" (
 echo Error: "%TMP%\web.config.hints.cancer.gov" does not exist! )

pause
exit

그러나 그에 따라 실행되지 않았습니다. 다음 메시지를 받았습니다.

C:\Users\dod\Desktop>if not exist "C:\Windows\Temp\web.config.hints.cancer.gov"
(echo Error: "C:\Users\dod\AppData\Local\Temp\web.config.hints.cancer.gov" does
not exist!  )
Error: "C:\Users\dod\AppData\Local\Temp\web.config.hints.cancer.gov" does not ex
ist!

C:\Users\dod\Desktop>pause
Press any key to continue . . .

답변1

%TMP%둘 다 가 아닌 을 %TEMP%가리킵니다 . 전체 경로를 작성하거나 다음과 같이 수동으로 변수에 넣어야 합니다.C:\Users\username\AppData\Local\TempC:\Windows\Temp

SET folder="C:\Windows\Temp"

...your code...

echo Error: %folder%\web.config.hints.cancer.gov does not exist!

관련 정보