$s = 'curl http://xxx.com/getinfo --connect-timeout 5 -m 2 | findstr "name="' $domain = echo $s | Select-String -Pattern 'http://(.*)\.' | %{$_.Matches.Groups[1].value} echo $domain