Quantcast
Channel: foreach | Operating systems, scripting, PowerShell and security | jesusninoc.com
Browsing all 409 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Detectar si una palabra está contenida en una línea de un fichero

[System.Collections.ArrayList] $arraylist = New-Object System.Collections.ArrayList #Añadir todas las palabras del fichero al ArrayList (el fichero contiene una frase por línea) #Ejemplo de fichero...

View Article


Image may be NSFW.
Clik here to view.

Analizar la extensión de un archivo según sus cabeceras con PowerShell

ForEach ($fichero in Get-ChildItem *.*) { #Datos del fichero $fichero #Fichero en formato decimal [System.IO.File]::ReadAllBytes($fichero)[0..3] -join "" #Ficheor en formato hexadecimal $magic =...

View Article


Image may be NSFW.
Clik here to view.

Agrupar palabras contenidas en un fichero

[System.Collections.ArrayList] $arraylist = New-Object System.Collections.ArrayList #Añadir todas las palabras del fichero al ArrayList (el fichero contiene una palabra por línea) ForEach ($elemento in...

View Article

Image may be NSFW.
Clik here to view.

Obtener empresas del IBEX 35 en formato JSON

[System.Collections.ArrayList] $arraylist = New-Object System.Collections.ArrayList # Obtener empresas del IBEX 35 $web = Invoke-WebRequest...

View Article

Calcular el valor nutricional de una o varias comidas del día con PowerShell

# Suma de todas las Kcal de la comida $SumaKcal = 0 # En el fichero alimento se encuentra el nombre del producto y la cantidad consumida # Macarrones+gallo,200 # aceituna+hojiblanca+de+cultivo,50 #...

View Article


Image may be NSFW.
Clik here to view.

Ejecutar el cmdlet de PowerShell que recupera el contenido de la caché de...

using System; using System.Management.Automation; // Windows PowerShell namespace. namespace HostPS1 { class HostPS1 { static void Main(string[] args) { // Call the PowerShell.Create() method to create...

View Article

Image may be NSFW.
Clik here to view.

Ejecutar el cmdlet de PowerShell para obtener información de la memoria RAM...

using System; using System.Management.Automation; // Windows PowerShell namespace. namespace HostPS1 { class HostPS1 { static void Main(string[] args) { // Call the PowerShell.Create() method to create...

View Article

Image may be NSFW.
Clik here to view.

Ejecutar un código de C# desde PowerShell que ejecuta un cmdlet de PowerShell

$CodigoC = @” using System; using System.Management.Automation; // Windows PowerShell namespace. namespace HostPS1 { public class HostPS1 { public static void Main() { // Call the PowerShell.Create()...

View Article


Mostrar un mensaje si se ha ejecutado correctamente un script de PowerShell...

using System; using System.Collections.ObjectModel; using System.Management.Automation; // Windows PowerShell namespace. namespace PowerSh { class PowerSh { static void Main(string[] args) { using...

View Article


Image may be NSFW.
Clik here to view.

Recorrer el segundo nivel de un sitio web y obtener información de todos los...

$url="http://www.jesusninoc.com" foreach($links in (Invoke-WebRequest $url).Links.href){foreach($links2 in (Invoke-WebRequest $links).Links.href){$links2,(Invoke-WebRequest...

View Article

Ofuscación en PowerShell

#################################################################### #Convertir una cadena de caracteres a binario (Char - Int - Binario) $resultado = "" $codificar = 'GC' foreach($letra in...

View Article

Image may be NSFW.
Clik here to view.

Recorrer el primer nivel de un sitio web y obtener información de todos los...

$url="http://www.jesusninoc.com" foreach($links in (Invoke-WebRequest $url).Links.href){($links,(Invoke-WebRequest $links).RawContentLength,1)} Recorrer el primer nivel de un sitio web y obtener...

View Article

Image may be NSFW.
Clik here to view.

Recorrer el segundo nivel de un sitio web y obtener todos los enlaces del sitio

$url="http://www.jesusninoc.com" foreach($links in (Invoke-WebRequest $url).Links.href){foreach($links2 in (Invoke-WebRequest $links).Links.href){$links2}} Recorrer el segundo nivel de un sitio web y...

View Article


Image may be NSFW.
Clik here to view.

Automatizar el recorrido de niveles de un sitio web, obteniendo información...

#Clase Enlace con información sobre el enlace: URL, tamaño y nivel de recorrido class Enlace { $URL $Long $Level Enlace($URL,$Long,$Level) { $this.URL=$URL $this.Long=$Long $this.Level=$Level } }...

View Article

Image may be NSFW.
Clik here to view.

Realizar una comunicación enviando preguntas y respondiendo de forma...

Introducción####################################################################################################...

View Article


El bucle ForEach en PowerShell

$numeros=1..5 $numeros | %{$PSItem} $numeros | %{$_} foreach($numero in $numeros) { $numero } The post El bucle ForEach en PowerShell appeared first on Scripting and security.

View Article

El bucle ForEach en PowerShell con exit, break, continue y return

El ForEach se ejecuta normal# El ForEach se ejecuta normal 1..5 | %{ $_ }exit# Se detiene TODO y sale del ámbito # Muestra 1 y sale de TODO 1..5 | %{ if($_ -eq 2){exit;$_;} else{$_} }break# Sale del...

View Article


Image may be NSFW.
Clik here to view.

Convertir una web con una tabla de calorías de todos los alimentos en una...

$url = "http://recetasdecocina.elmundo.es/tabla-calorias" $result = Invoke-WebRequest $url $objetoresult = $result.AllElements | Where tagName -eq “TR” | %{$_.outerHTML -replace "<TD...

View Article

Image may be NSFW.
Clik here to view.

Calcular el valor nutricional (azúcares) de todos los fabricantes de...

$productosconurl = @{} $web = Invoke-WebRequest "https://www.alcampo.es/compra-online/bebidas/zumos-de-frutas/naranja/c/W110201?q=%3Arelevance&show=All" foreach($link in ($web.links.href |...

View Article

Image may be NSFW.
Clik here to view.

Mostrar y comparar la cantidad de azúcar que tienen los productos de consumo...

Productos analizados: Bollería y pastelería Leche Galletas Zumo de naranja Zumo de melocotón Zumo de mosto Importante VALOR NUTRICIONAL MEDIO POR 100 (Columna Valor). ALGUNOS PRODUCTOS PUEDEN TENER...

View Article
Browsing all 409 articles
Browse latest View live