Repository: PowerShell/PowerShell
File: src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs (C#)

Code before:
        private const string FilePathParameterName = "FilePath";

        /// <summary>
        /// Returns completion results for verb parameter.
        /// </summary>
        /// <param name="commandName">The command name.</param>
        /// <param name="parameterName">The parameter name.</param>
        /// <param name="wordToComplete">The word to complete.</param>
        /// <param name="commandAst">The command AST.</param>
        /// <param name="fakeBoundParameters">The fake bound parameters.</param>
        /// <returns>List of Completion Results.</returns>
        public IEnumerable<CompletionResult> CompleteArgument(
            string commandName,
            string parameterName,
            string wordToComplete,
            CommandAst commandAst,
            IDictionary fakeBoundParameters)
        {
            // -Verb is not supported on non-Windows platforms as well as Windows headless SKUs
            if (!Platform.IsWindowsDesktop)
            {
                yield break;
            }

            if (commandName.Equals(StartProcessCommandName)
                && fakeBoundParameters.Contains(FilePathParameterName))
            {
                string filePath = fakeBoundParameters[FilePathParameterName].ToString();
                string fileExtension = Path.GetExtension(filePath);

                if (!string.IsNullOrEmpty(fileExtension))
                {
                    var verbPattern = WildcardPattern.Get(wordToComplete + "*", WildcardOptions.IgnoreCase);

                    string[] verbs = new ProcessStartInfo(filePath).Verbs;

                    foreach (string verb in verbs)
                    {
                        if (verbPattern.IsMatch(verb))
                        {
                            yield return new CompletionResult(verb);
                        }
                    }
                }
            }
        }
    }

#if !UNIX
    /// <summary>
    /// ProcessCollection is a helper class used by Start-Process -Wait cmdlet to monitor the

Review comment (suggestion):
Is Ordinal correct here? In any case it is better explicit comparison:
```suggestion
            if (commandName.Equals(StartProcessCommandName, StringComparison.OrdinalIgnoreCase)
                && fakeBoundParameters.Contains(FilePathParameterName))
```

Code after:
    public class VerbArgumentCompleter : IArgumentCompleter
    {
        /// <summary>
        /// Returns completion results for verb parameter.
        /// </summary>
        /// <param name="commandName">The command name.</param>
        /// <param name="parameterName">The parameter name.</param>
        /// <param name="wordToComplete">The word to complete.</param>
        /// <param name="commandAst">The command AST.</param>
        /// <param name="fakeBoundParameters">The fake bound parameters.</param>
        /// <returns>List of Completion Results.</returns>
        public IEnumerable<CompletionResult> CompleteArgument(
            string commandName,
            string parameterName,
            string wordToComplete,
            CommandAst commandAst,
            IDictionary fakeBoundParameters)
        {
            // -Verb is not supported on non-Windows platforms as well as Windows headless SKUs
            if (!Platform.IsWindowsDesktop)
            {
                yield break;
            }

            // Completion: Start-Process -FilePath <path> -Verb <wordToComplete>
            if (commandName.Equals("Start-Process", StringComparison.OrdinalIgnoreCase)
                && fakeBoundParameters.Contains("FilePath"))
            {
                string filePath = fakeBoundParameters["FilePath"].ToString();

                // Complete file verbs if extension exists
                if (Path.HasExtension(filePath))
                {
                    foreach (string verb in CompleteFileVerbs(filePath, wordToComplete))
                    {
                        yield return new CompletionResult(verb);
                    }

                    yield break;
                }

                // Otherwise check if command is an Application to resolve executable full path with extension
                // e.g if powershell was given, resolve to powershell.exe to get verbs
                using var ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);

                var commandInfo = new CmdletInfo("Get-Command", typeof(GetCommandCommand));

                ps.AddCommand(commandInfo);
                ps.AddParameter("Name", filePath);
                ps.AddParameter("CommandType", CommandTypes.Application);