如一个文本文件test.txt有大于一行以上的内容: Line1 Line2 … (get-content test.txt)[0] 值为Line1,(get-content test.txt)[1] 值为Line2,… ————————————— 如一个文本文件test.txt只有一行内容: Line1 (get-content test.txt)[0] 值为l,(get-content test.txt)[1] 值为i,… 每次处理文本都要多加个行数判断,来区别对待,好烦。是本就有这个问题还是根本我的用法有问题?求解。
[System.Array]$texts = get-content test.txt ; $texts[0]
对 这个不错