1.

Solve : getting a file's directory?

Answer»

Hi all,

I have a file called myfile.bat in the C:\A\B directory.  The file is normally run from C:\A not the file's directory of C:\A\B.  I want to set a variable within myfile.bat to KNOW that it is in C:\A\B.  How do I do this?  

When I try %cd% I always get "C:\A" since that's the WORKING directory.

Any help would be appreciated.  FYI, I am USING Windows XP.

Thanks,
Ajit

use the "if exist c:\a\b\myfile.bat "

then TAKE some action based on findings

forgot to set the variable..

"if exist c:\a\b\myfile.bat set filefound = T "

now the variable %filefound% contains the result.



Discussion

No Comment Found