• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

SOLVED IF EXIST ELSE batch file not working

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

nfinity

Member
Joined
Jul 8, 2012
making simple batch file and it won't see the file, I know i have that exact file in that exact dir, but it won't see it....


@echo off
IF EXIST "C:\Users\Scoot\Downloads\test.txt" (echo Exist) ELSE (echo Missing)
pause


Can you tell me whats wrong with my code please
 
Your code works for me when I try it with a file that exists on my system. Are you 100% sure that that file does in fact exist at that path? If so, is it a file that your user normally has access to? (In your example, if you aren't logged in as "Scoot", Windows may restrict your access to that file.)
 
well, i got it working here today on my work computer with
C:\Users\%userprofile%\Downloads\test.txt
that was my only change to the code and the username was correct before. so I have to check it again at home, thanks
 
Back