L'utilisation d'une expression régulière est probablement la solution la plus simple de la tâche. Cela peut se faire dans PowerShell:
$text = @'
-car:"Nissan" -Model:"Dina" -Color:"Light-blue" -wheels:"4" -windowSize.Front:"24"
'@
# assume parameter values do not contain ", otherwise this pattern should be changed
$pattern = '-([\.\w]+):"([^"]+)"'
foreach($match in [System.Text.RegularExpressions.Regex]::Matches($text, $pattern)) {
$param = $match.Groups[1].Value
$value = $match.Groups[2].Value
"$param is $value"
}
Sortie:
car is Nissan
Model is Dina
Color is Light-blue
wheels is 4
windowSize.Front is 24
Comment est-il lié à PowerShell? – stej