diff --git a/src/cascadia/TerminalApp/TerminalPage.cpp b/src/cascadia/TerminalApp/TerminalPage.cpp index cd4eba67a..d83263e06 100644 --- a/src/cascadia/TerminalApp/TerminalPage.cpp +++ b/src/cascadia/TerminalApp/TerminalPage.cpp @@ -1490,6 +1490,7 @@ namespace winrt::TerminalApp::implementation // - C:\windows\system32\cmd.exe -> returns true // - cmd.exe -> returns false // - C:\windows\system32\cmd.exe /k echo sneaky sneak -> returns false + // - %SystemRoot%\System32\cmd.exe -> TODO! static bool _isInSystem32(std::wstring_view commandLine) { // use C++11 magic statics to make sure we only do this once. @@ -1575,12 +1576,16 @@ namespace winrt::TerminalApp::implementation { if (const auto& tabImpl{ _GetTerminalTabImpl(tab) }) { - tabImpl->GetRootPane()->WalkTree([warningControl, cmdline](std::shared_ptr pane) -> bool { + tabImpl->GetRootPane()->WalkTree([warningControl, cmdline, tabImpl](std::shared_ptr pane) -> bool { if (pane->GetUserControl() == *warningControl) { // Hooray, we found us! pane->ReplaceControl(warningControl->Control()); - // Don't return true here. We want to make sure to chekc + // Update the title, because replacing the control like + // this is a little weird, and doesn't actually trigger + // a TitleChanged by itself. + tabImpl->UpdateTitle(); + // Don't return true here. We want to make sure to check // all the panes for the same commandline we just // approved. } @@ -1593,6 +1598,7 @@ namespace winrt::TerminalApp::implementation { // Go ahead and allow them as well. pane->ReplaceControl(otherWarning->Control()); + tabImpl->UpdateTitle(); } } return false; diff --git a/src/cascadia/TerminalSettingsModel/userDefaults.json b/src/cascadia/TerminalSettingsModel/userDefaults.json index 13cda81aa..55d6805f4 100644 --- a/src/cascadia/TerminalSettingsModel/userDefaults.json +++ b/src/cascadia/TerminalSettingsModel/userDefaults.json @@ -35,14 +35,14 @@ // Make changes here to the powershell.exe profile. "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}", "name": "Windows PowerShell", - "commandline": "powershell.exe", + "commandline": "%SystemRoot%\\System32\\WindowsPowerShell\\v1.0\\powershell.exe", "hidden": false }, { // Make changes here to the cmd.exe profile. "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}", "name": "%COMMAND_PROMPT_LOCALIZED_NAME%", - "commandline": "cmd.exe", + "commandline": "%SystemRoot%\\System32\\cmd.exe", "hidden": false } ]