Save raw command instead of resolved command in shell history (#10000)

This commit is contained in:
Sean Lin 2021-03-04 09:04:31 -08:00 committed by GitHub
parent 8f3e0517ca
commit f648ac44b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -156,8 +156,8 @@ namespace Microsoft.Plugin.Shell
private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdministrator = false)
{
command = command.Trim();
command = Environment.ExpandEnvironmentVariables(command);
string trimmedCommand = command.Trim();
command = Environment.ExpandEnvironmentVariables(trimmedCommand);
var workingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
var runAsAdministratorArg = !runAsAdministrator && !_settings.RunAsAdministrator ? string.Empty : "runas";
@ -218,7 +218,7 @@ namespace Microsoft.Plugin.Shell
info.UseShellExecute = true;
_settings.AddCmdHistory(command);
_settings.AddCmdHistory(trimmedCommand);
return info;
}