About 189,000 results
Open links in new tab
  1. Read file line by line in PowerShell - Stack Overflow

    Nov 4, 2015 · Original Comment (1/2021) I was able to read a 4GB log file in about 50 seconds with the following. You may be able to make it faster by loading it as a C# assembly dynamically using PowerShell. You may be able to make it faster by loading it as a C# assembly dynamically using PowerShell.

  2. Powershell retrieving a variable from a text file - Stack Overflow

    Is there a way to read a text file C:\\test.txt and retrieve a particular value? ie file looks like this: serverName=serv8496 midasServer=serv8194 I want to set the value of a variable in my scrip...

  3. How to process a file in PowerShell line-by-line as a stream

    Even if you find a way to read it faster processing of huge amount of lines will be slow in PowerShell anyway and you cannot avoid this. Even simple loops are expensive, say for 10 million iterations (quite real in your case) we have:

  4. Read UTF-8 files correctly with PowerShell - Stack Overflow

    Apr 2, 2014 · A PowerShell script creates a file with UTF-8 encoding; The user may or may not edit the file, possibly losing the BOM, but should keep the encoding as UTF-8, and possibly changing the line separators; The same PowerShell script reads the file, adds some more content and writes it all as UTF-8 back to the same file; This can be iterated many times

  5. powershell - Store Entire Text File Contents in Variable - Stack …

    I'd like to use PowerShell to store the entire contents of a text file (including the trailing blank line that may or may not exist) in a variable. I'd also like to know the total number of lines in the text file.

  6. powershell - How to load or read an XML file using ConvertTo-Xml …

    Dec 12, 2020 · XML can come in numerous file encodings, and using the XmlDocument.Load method makes sure the file is read properly without prior knowledge of the encoding. Not reading a file with the correct encoding will result in mangled data or …

  7. Extracting columns from text file using PowerShell

    May 23, 2017 · Note that this requires PowerShell 2.0 for the -split operator. Also, the ,4 tells the the split operator the maximum number of split strings you want but keep in mind the last string will always contain all extras concat'd.

  8. Read a properties file in powershell - Stack Overflow

    Nov 28, 2013 · If you are running with powershell v2.0 you might be missing the "-Raw" argument for Get-Content. In this case you can use the following. Content of C:\temp\Data.txt:

  9. powershell - How to load a JSON file and convert it to an object of …

    Mar 8, 2016 · I have a type FooObject and I have a JSON file which was serialized from a FooObject instance. Now I want to use ConvertFrom-Json to load the JSON file to memory and covert the output of the command to a FooObject object, and then use the new object in a cmdlet Set-Bar which only accept FooObject as the parameter type.

  10. How to read an XML file using PowerShell and filter the required …

    May 10, 2019 · Edit. If you need to do this on multiple xml files and these files are inside the same root path, you could loop through using Get-ChildItem to get the xml files and process them like in the examples I gave.

Refresh