This Java programm opens a Batch file and passes the string folderName
public class FolderCreator {
public static void main(String[] args) {
try{
Process p = Runtime.getRuntime().exec("C:/Documents/NameFolder.bat folderName");
p.waitFor();
}catch(Exception e) {
System.out.println(e);
}
}
}
This is the NameFolder.bat file. It shall create a folder with the name from the passed Java variable above.
//What do I need to ad here?
if not exist "C:\Desktop\folderName\" mkdir C:\Desktop\folderName
What do I need to add to the Batch file?
EDIT:
This works
if not exist "C:\Desktop\%1\" mkdir C:\Desktop\%1
%1work?folderNamethrough theargs? Why do you want to use a scripting language via Java when there'sjava.nio? You could just create aPaththat points to the desktop and thenresolvethe folder name...