Here is my situation:
I have a .bat file that can be called from several different
directories. This .bat file calls a JAVA class, which in turn creates
a document. This document is always created in the directory that the
.bat file changes to. Is there a way in the JAVA class to retrieve the
directoy that the .bat file was called from (the directory that the
command line was at), so that the document is created in that one
instead?
Currently to do this, I have to send in the arguement with an absolute
path, which I don't want to have to do.
Thanks for the help.
Matt
Jeff Schwab - 20 Aug 2005 04:58 GMT
> Here is my situation:
>
[quoted text clipped - 8 lines]
> Currently to do this, I have to send in the arguement with an absolute
> path, which I don't want to have to do.
That path is available in the batch file as %CD%. You can pass that as
an argument from the batch file to your Java program.
hust6 - 22 Aug 2005 15:38 GMT
This is a possibility. By chance, is there anyway that I could
retrieve the directory without passing the directory to the Java
program. I realize this may be far-fetched, but could it be possible?
Jeff Schwab - 23 Aug 2005 04:14 GMT
> This is a possibility. By chance, is there anyway that I could
> retrieve the directory without passing the directory to the Java
> program. I realize this may be far-fetched, but could it be possible?
I don't know of any way to get the command line unless the shell is
willing to give it up. Some shell interpreters are also servers that
can be queried via sockets for this sort of information; tclsh comes to
mind. I don't think CMD.EXE is anything like that sophisticated, though.
Yakov Fain - 29 Aug 2005 17:21 GMT
Matt,
Have you tried System.getProperty("user.dir")?
Yakov Fain
> Here is my situation:
>
[quoted text clipped - 12 lines]
>
> Matt