I want to start explorer and select a specific file. So I run
QProcess::startDetached(command);
with command set to
explorer.exe /select,C:\Users\....\file.txt
This works fine, but will fail if the path to the file contains spaces. But if I put the path in quotes
explorer.exe /select,"C:\Users\....\file.txt"
the explorer will open the documents folder and not the specified path. Running the same string from the command line works fine.
The string is initialized with
command = "explorer.exe" + "/select," + "\"" + QDir::toNativeSeparators(path) + "\"";