Reputation: 83
IF EXIST %PROGRAMFILES%\Winamp\paths.ini ( REM do stuff )
This file (and the folder) DOESN'T exist but it outputs true.
The script is on "K:\" and eventually got started with another file (%1) which as far as i know changes the start directory.
I have no clue why this doesn't work.
Also i tried to navigate to %PROGRAMFILES% and check the existance of \Winamp\ but for some reason it stays at it's home directory (or the one of %1).
Upvotes: 0
Views: 38
Reputation: 360662
You probably need quotes around the path, because %PROGRAMFILES%
is going to expand to C:\Program Files
IF EXIST "%PROGRAM%FILES%\Winamp\paths.ini%"
e.g. Without quotes, note how it shows "file not found" TWICE:
C:\Users\marc>dir %PROGRAMFILES%
Volume in drive C is Windows7_OS
Volume Serial Number is 0E31-0E35
Directory of C:\
File Not Found
Directory of C:\Users\marc
File Not Found
because it was interpreted as
dir C:\Program Files
which executes as
dir C:\Program
dir Files
With quotes, it works:
C:\Users\marc>dir "%PROGRAMFILES%"
Volume in drive C is Windows7_OS
Volume Serial Number is 0E31-0E35
Directory of C:\Program Files
18/07/2014 04:02 PM <DIR> .
18/07/2014 04:02 PM <DIR> ..
Upvotes: 1