diff --git a/src/cascadia/TerminalApp/AppCommandlineArgs.cpp b/src/cascadia/TerminalApp/AppCommandlineArgs.cpp index 1b7881dc271..a6fdb5a6002 100644 --- a/src/cascadia/TerminalApp/AppCommandlineArgs.cpp +++ b/src/cascadia/TerminalApp/AppCommandlineArgs.cpp @@ -707,6 +707,15 @@ NewTerminalArgs AppCommandlineArgs::_getNewTerminalArgs(AppCommandlineArgs::NewT if (*subcommand.startingDirectoryOption) { + // This is a fix for the way CommandLineToArgvW parse the command line removing + // the opening quote and maintaining the closing quote because of a trailing + // slash from the path. + // Example: --startingDirectory "C:\Users\my user\" + if (_startingDirectory.length() > 2 && _startingDirectory.front() != '\"' && _startingDirectory.back() == '\"') + { + _startingDirectory.pop_back(); + _startingDirectory.push_back('\\'); + } args.StartingDirectory(winrt::to_hstring(_startingDirectory)); }