File f = new File("BatchFile.bat");
String path = f.getAbsolutePath();
works and returns full path of the file BUT the problem i am having is with string that is returned. it is returned in the form C:\folder\subfoler\filename but due to the path localization in java i cannot use
String[] cmds = {"cmd", "/k", path};
the string needs to be in the form C:\\folder\\subfolder\\filename and i have been trying to look for a way to modify the string into this format.
now if we use getAbsolutePath() and store it in a String called path
path = "C:\folder\subfolder\filename"
to be hoenst my problem wasnt with the File class but modifying the string f.getAbsolutePath() returned to use with the Runtimeclass, which you have explained in your final post.
a fool thinks himself to be wise, but a wise man knows himself to be a fool - shakespeare. foolish tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|