How do I dynamically add elements to arrays in PowerShell?

前端 未结 4 1588
执念已碎
执念已碎 2021-02-12 15:10

I don\'t have much PowerShell experience yet and am trying to teach myself as I go along.

I\'m trying to make some proof of concept code for a bigger project. The main g

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-12 15:42

    $testArray = [System.Collections.ArrayList]@()
    $tempArray = "123", "321", "453"
    
    foreach($item in $tempArray)
    {
        $arrayID = $testArray.Add($item)
    }
    

提交回复
热议问题