1.

Solve : Absolute path?

Answer»

Hi

Im modifying an application and I have created a batch file (setenv.bat) to set all the ENVIRONMENT variables the program needs. But the most important one is the location of the disk of the program : its absolute path.

Is there a way to determine the exact location of the setenv.bat ? I have tried %CD% but it changes if I launch the file from another DIRECTORY.

Thanks
%CD% will always return the directory that you're logged into. I don't really understand your question (Sunday mornings are never my best moments ). SINCE you created setenv.bat, presumably you know where you saved it.

Maybe, if you re-worded your question, we could help you.

Let US know. The setenv.bat file will be installed at the location of the program during installation.

I have tried %CD% but if you cal setenv.bat since another directory %CD% will have this other directory, so it's useless.

I tried to see if truename can be the solution but behind it its a search on the disk : not very efficient to start a program.

Right now, I fall back to use NSIS to install the program at the location the user want and to set directly in the file setenv.bat the location by rewriting the file.

If the user wants to move the application he will have to modify the file.mind posting PART that you're talking about, u kinda lost me on what you're wanting...using the FOR command, you can reveal your "ABSOLUTE PATH" with the " %~fI " - expands %I to a fully qualified path name.

type HELP FOR in a dos box for details...



Discussion

No Comment Found