You are not logged in.
This isn't really a problem, I'm just curious if there's some reason for this behavior.
Let's say that you're in the root of external drive G:, and there's a directory called "Temp". If you type;
IF EXIST "G:Temp" ECHO Exists!
It prints Exists! because it finds it, despite the missing backslash after "G:".
However if you type;
CD Temp\
IF EXIST "G:Temp" ECHO Exists!
Nothing prints because it can't find that directory without the backslash. In fact it fails if you're in any directory on that drive. However it works fine from within directories on other drives.
Is there some reason for this, or is it just a weird quirk?
Offline
If you dont specify a parent folder, either \ or any other folder, then IF EXIST will look for the item in the current directory, which could be g:\temp or g:\documents\temp or whatever folder you are in.
The Windows CMD shell holds a current directory for each drive and for each session.
So you can have a current drive of C: and change the directory on g: with
C:> cd g:\documents
C:>
C:> g:
G:\documents>
Theres more about this here:
https://ss64.com/nt/cd.html
Offline
If you dont specify a parent folder, either \ or any other folder, then IF EXIST will look for the item in the current directory, which could be g:\temp or g:\documents\temp or whatever folder you are in.
The Windows CMD shell holds a current directory for each drive and for each session.
So you can have a current drive of C: and change the directory on g: with
C:> cd g:\documents
C:>
C:> g:
G:\documents>
Theres more about this here:
https://ss64.com/nt/cd.html
OK, thanks for the explanation.
Offline