Store complete cmd line to a string
The user is executing a file filename.xml kept inside the folder D:\folder. Could anyone please tell me how do I capture D:\folder to a stringD:\folder>BatchFilename filename.xml
[216 byte] By [
sony_tja] at [2007-11-27 5:51:38]

Take a look here:
public class Example {
public static void main(String[] args) {
String path = "D:\\myDir\\myfile.xml";
String dir = path.substring(0,path.lastIndexOf('\\'));
System.out.println(dir);
}
}
@Op. D:\folder is probably the current working directory, and you can get hold of that using System.getProperty("user.dir");That will of course not work if the batch file (which I guess is launching your java app?) is doing cd to another directory.Kaj
kajbja at 2007-7-12 15:41:09 >
