Hi
Trying to use RegEx (in VB.NET app) to parse a Win32_Service PathName to just get the path without any arguments
The below works well in most cases:
Dim ExecutablePath = Regex.Replace(PathName, "^""([^""])"".$", "$1")
e.g. for
"C:\Program Files\AVG\Antivirus\AVGSvc.exe" /runassvc
but doesn't work if first part isn't in quotes e.g.
C:\WINDOWS\system32\SearchIndexer.exe /Embedding
Can someone please help me improve the RegEx so it works for both? and would return
"C:\Program Files\AVG\Antivirus\AVGSvc.exe" for first example
and
C:\WINDOWS\system32\SearchIndexer.exe for second example
Thank you