The answers here that worked for me in Windows were creating a transient virtual drive, as shown by dbenham (but this is not a viable solution for a general automated process that may be run on different computers and would be inefficient and impractical for multiple parallel threaded operations) or getting the short path string as pointed out by Jugal Shah (which is not always convenient, as it requires unmanaged code accessing kernel32.dll to utilize in C#, for example). However, it's an easy fix if you recompile the necessary blast project files from the source code.
If you are able to download the blast project code (e.g. version 2.12.0 from https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.12.0/), you can rebuild makeblastdb.exe after modifying just two lines of code, and after rebuilding makeblastdb, db targets enclosed in quotes should work correctly when there are spaces in the path. Note: This was tested with v2.12.0 in Windows 11 with Visual Studio 2019, after first following project configuration instructions included with the ncbi code package and building and testing makeblastdb.exe, blastn.exe and blast_formatter.exe.
Lines of code to modify:
-- In .\ncbi-blast-2.12.0\c++\src\app\blastdb\makeblastdb.cpp, line 202 reads (if not line 202, close to it):
static const string kInputSeparators(" ");
To change the multi-input separator to, for example, a comma instead of a space, change it to:
static const string kInputSeparators(",");
-- In .\ncbi-blast-2.12.0\c++\src\objtools\blast\seqdb_reader\seqdbcommon.cpp, line 1789 reads (if not line 1789, close to it):
if (ch == ' ') {
Change it to:
if (ch == ',') {
Rebuild makeblastdb.exe and the problem should be solved. Enclose the target "-in" path in quotes and it should no longer be parsed into space-delimited strings.
If you want other programs (e.g. blastn, blast_formatter, etc.) to work correctly with quote-enclosed paths with spaces in the path, those modules will need to be rebuilt as well.