• EnglishSpanishGermanFrenchPolishChinese (Traditional)


EnglishSpanishGermanFrenchPolishChinese (Traditional)

Operating systems, scripting, PowerShell and security

Operating systems, software development, scripting, PowerShell tips, network and security

Menú principal
  • Categorías
  • Cursos
  • Libro de PowerShell (nivel medio)
  • Libro de PowerShell (nivel avanzado)
  • Lo mejor
  • Lo último
  • Proyectos
  • Contactar
Ir al contenido

Leer archivos de texto rápidamente con PowerShell

PowerShell
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
$path = '.\palabrafinallargas.txt'
 
# Lento
Measure-Command {
$text = Get-Content -Path $Path
}
# Rápido
Measure-Command {
$text = Get-Content -Path $Path -Raw
}
# Rápido
Measure-Command {
$text = Get-Content -Path $Path -ReadCount 0
}
# Rápido con .NET
Measure-Command {
$text = [System.IO.File]::ReadAllText($path )
}

Fuente original del Tip http://community.idera.com/powershell/powertips/b/tips/posts/reading-text-files-fast-1152612330

Publicado el día 9 de agosto de 2018

CATEGORÍAS

PowerShell, Sistema de archivos

ETIQUETAS

.NET, Get-Content, HTTP, IP, Jesús Niño, Jesús Niño Camazón, Path

MÁS

  • ¿Cómo sería la certificación Linux LPIC1-102 para PowerShell? (posible equivalencia entre Linux y PowerShell)
  • Libro de PowerShell (nivel avanzado), (libro online de PowerShell), (tutorial gratis de PowerShell)
  • Detectar cuando se pulsa una tecla desde PowerShell
  • Buscar el nombre de una clase de un formulario en PowerShell con Microsoft Spy++ y escribir un mensaje en una caja de texto sin conocer el identificador de ventana en concreto del proceso…
  • Gestión de la información (Sistemas informáticos)
  • 12. Gestión de una web con WordPress y PowerShell (nivel intermedio)
Jesusninoc utiliza cookies: saber más aquí.