About 18,000,000 results
Open links in new tab
  1. How to save each line of text file as array through powershell

    Sep 5, 2018 · In order to ensure that a command's output is always an array, PowerShell offers @(...), the array-subexpression operator, which wraps even single-object output in an array. …

  2. PowerShell Read File Into Array: A Simple Guide

    In PowerShell, you can read the contents of a file into an array by using the `Get-Content` cmdlet, which allows you to easily manipulate and access each line of the file as an individual element. …

  3. How To Read File Line By Line Into Array In PowerShell?

    Feb 8, 2024 · To read a file line by line into an array in PowerShell, use the Get-Content cmdlet which automatically returns an array of strings, with each line from the file as an element in the …

  4. PowerShell: How to Save Each Line of Text File as Array

    Jun 22, 2024 · Often you may want to save each line of a text file as an array in PowerShell. You can use the following methods to do so: Method 1: Use Get-Content. This particular example …

  5. Use txt file as list in PowerShell array/variable

    Aug 30, 2017 · I think you could use Get-Content to get the value from a text file. You would just need to know the name of the text file, or pattern of the name and use Get-ChildItem to scan a …

  6. Parsing Text file and placing contents into an Array Powershell

    Jul 15, 2014 · I am looking for a way to parse a text file and place the results into an array in powershell. I know select-string -path -pattern will get all strings that match a pattern. But what …

  7. Powershell Convert String [] to List<String> - Stack Overflow

    Feb 13, 2014 · Instead, I will tell you how to fix the problem. To convert a String[] object into a List<String> object in PowerShell, you need to explicitly cast it to such: In your specific case, …

  8. Reading list style text file into powershell array

    Jul 8, 2019 · One solution is to convert your data to an array of hash tables that can be read into a custom object. Then the output array object can be exported, formatted, or read as required.

  9. Powershell: List Values of text file as a list - Stack Overflow

    Jul 31, 2020 · I am trying to list the values within a text file. I tried Get-Content a.txt and the list works fine. But when I output it to an email string (Send-MailMessage) the list is not coming up …

  10. Using Powershell to convert a file's contents into a string that …

    Dec 1, 2018 · # get contents and convert to JSON $contentToInsert = Get-Content $sourceFilePath -raw | ConvertTo-Json # write in output file (Get-Content $outputFile …

Refresh