batch file - Incorrect *.bat execution from Java -
this question has answer here: changing working-directory of command java 3 answers i have .bat file following content example: mkdir testdir now put folder c:\temp want run using java following: runtime.getruntime().exec("cmd /c start c:\\temp\\test.bat"); i expect folder created in c:\temp when execute file manually, folder being created in workspace wrong. how can fix it? you need specify working directory when run cmd . there overloads of runtime.exec() allow specify working directory. example: runtime.getruntime().exec("cmd /c start c:\\temp\\test.bat", null, new file("c:\\temp")); alternatively, can use processbuilder give rather more explicit control of various aspects of process you're starting.