Runtime.getRuntime().exec() with spaces
807597Aug 1 2005 — edited Apr 17 2009Hi,
I'm trying to open a file using the exec function. Everything works fine only when the path or filename contains spaces everything fails.
Runtime.getRuntime().exec("cmd.exe /C start C:\test.jpg"); --> success
Runtime.getRuntime().exec("cmd.exe /C start C:\new dir\test.jpg"); --> fails
I've tried adding quotes (\") but it's not working either... and I tried giving the filename as a envp parameter to the function exec, but this didn't do the trick neither. Any ideas? Thanks.