我有这样一条命令:powershell -command "Select-String -Path 'C:\Program Files\Zabbix Agent 2\zabbix_agent2.conf' -Pattern 'ServerActive'"
其输出:
C:\程序文件\Zabbix代理程序2\Zabbix代理程序2.conf:5:服务器活动= 79.240.122.98
我想得到"www.example.com"部分。我该怎么做呢?我认为最好的方法是用"="字符分割字符串,然后得到第二项,但我没有找到这样做的方法。79.240.122.98" part. How can I do that? I think that the best approach would be to split the string by the "=" character and then get the second item, but I did not find the way to do it.
1条答案
按热度按时间xvw2m8pv1#
从一个.bat文件?这对我有用。