// create a vector for each argument passed within lpCmdLine // takes into consideration any white space and quotes vector args; string arg; const char *p = lpCmdLine; bool quote = false; while (char ch = *p++) { if (!quote && iswspace(ch) && arg.length()) { args.push_back(arg); arg = ""; } else if (ch == '"') quote = !quote; else if (!iswspace(ch) || quote || arg.length()) arg += ch; } if (arg.length()) args.push_back(arg);