java - Overcoming Space Character error in Runtime.getRuntime().exec -


i trying launch command prompt via java application , run bat file in specific file path. "runtime.getruntime().exec" not accept spaces in file path. aware can contained following option,

runtime.getruntime().exec("cmd /c start \"d:\\test\\spaced folder\\start.bat"); 

however, in case have used filepath string have captured textbox. so, have used below syntax,

runtime.getruntime().exec("cmd /c start "+filename+"\\start.bat"); 

in case still error "windows cannot find 'd:\test\spaced'. make sure typed name correctly , try again."

could please let me know how can overcome space character incompatibility when using string reference in runtime.getruntime().exec , if string has spaces in it.

thanks in advance everyone.

quote path:

runtime.getruntime().exec("cmd /c start \""+filename+"\\start.bat\""); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -