1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
ForEach($fichero in ls .) { #Cifrar el contenido del fichero $cifrado=gc $fichero $var=1 $textocifrado=(0..($cifrado.Length-1) | % {[char]::ConvertFromUtf32([char]::ConvertToUtf32($cifrado[$_].ToString(),0)+$var)}) -join "" #Cifrar el nombre y añadir el contenido cifrado #Quitamos los puntos y otros caracteres para no tener errores a la hora de crear el nuevo fichero cifrado $ficherosin=$fichero.Name.Replace(".","") $ficherosin $ficherocifrado=(0..($ficherosin.Length-1) | % {[char]::ConvertFromUtf32([char]::ConvertToUtf32($ficherosin[$_].ToString(),0)+$var)}) -join "" $textocifrado | Out-File $ficherocifrado } |