Sometimes it becomes necessary to extract the command name from a command line. Here is a function that can do this:
And this is the code:
function Remove-Argument { param ( $CommandLine ) $divider = ' ' if ($CommandLine.StartsWith('"')) { $divider = '"' $CommandLine = $CommandLine.SubString(1) } $CommandLine.Split($divider)[0] }