且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用 Powershell 获取变量中的第一行字符串

更新时间:2023-11-14 11:39:34

将换行符上的字符串拆分成一个数组,然后取数组的第一个是可行的,尽管它可能不是最有效的.

Splitting the string on newline into an array and then taking the first of the array will work, although it might not be the most efficient.

($eventResult.Message -split '\n')[0]