From f06cd1759fe37277b43340fbe420272c3def5bf1 Mon Sep 17 00:00:00 2001 From: "Dustin L. Howett" Date: Thu, 23 Mar 2023 18:14:48 -0500 Subject: [PATCH] VsDevCmdGenerator: respect the user's startingDirectory (#15035) The PowerShell equivalent was added in the initial pull request, #7774. Closes #13721 --- .github/actions/spelling/expect/expect.txt | 1 + src/cascadia/TerminalSettingsModel/VsDevCmdGenerator.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/.github/actions/spelling/expect/expect.txt b/.github/actions/spelling/expect/expect.txt index 4f26f5be340..f73deba781e 100644 --- a/.github/actions/spelling/expect/expect.txt +++ b/.github/actions/spelling/expect/expect.txt @@ -1771,6 +1771,7 @@ srv srvinit srvpipe ssa +startdir STARTF STARTUPINFO STARTUPINFOEX diff --git a/src/cascadia/TerminalSettingsModel/VsDevCmdGenerator.cpp b/src/cascadia/TerminalSettingsModel/VsDevCmdGenerator.cpp index 2b3f04e277d..f4e5dd0298a 100644 --- a/src/cascadia/TerminalSettingsModel/VsDevCmdGenerator.cpp +++ b/src/cascadia/TerminalSettingsModel/VsDevCmdGenerator.cpp @@ -42,6 +42,9 @@ std::wstring VsDevCmdGenerator::GetProfileCommandLine(const VsSetupConfiguration commandLine.reserve(256); commandLine.append(LR"(cmd.exe /k ")"); commandLine.append(GetDevCmdScriptPath(instance)); + // The "-startdir" parameter will prevent "vsdevcmd" from automatically + // setting the shell path so the path in the profile will be used instead. + commandLine.append(LR"(" -startdir=none)"); #if defined(_M_ARM64) commandLine.append(LR"(" -arch=arm64 -host_arch=x64)"); #elif defined(_M_AMD64)