Explorer: programmatically select file/directory with space in the path

Posted by Mike L. on Super User See other posts from Super User or by Mike L.
Published on 2012-11-29T08:51:58Z Indexed on 2012/11/29 11:10 UTC
Read the original article Hit count: 249

Filed under:
|

When I try to select a file or directory which has a space in its path in the Windows Explorer, it selects a completely different directory:

explorer.exe "/select,C:\Program Files\foobar"

I've tried it from Java with

Runtime.getRuntime().exec(new String[] {
    "explorer.exe",
    "/select," + filePath
});

and with the above command line. In both cases, the same result. What can I do to solve the problem?

© Super User or respective owner

Related posts about windows-7

Related posts about windows-explorer