elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Recuerda que debes registrarte en el foro para poder participar (preguntar y responder)


  Mostrar Mensajes
Páginas: 1 ... 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 [818] 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 ... 1236
8171  Programación / Programación General / Re: ¿Como puedo crear un SO? en: 19 Septiembre 2013, 00:58 am
Pues lo que sea, pero hay que comprar algun derecho para crear un sistema operativo con eso?  

La pregunta era muy obvia, pero es que existe una cosa que se llama "buscar", y otra cosa que se llama "FAQ" (Frequently Asked Questions), si combinas esas dos proezas obtienes resultados como este:

http://en.opensuse.org/openSUSE:SUSE_Studio_Faq#How_much_does_it_cost.3F

Por cierto, en la misma página encontrarás un enlace a la "licencia" de SuseStudio, pero eso ya dejo que lo "busques" tú, de todas formas cuando instalas el software también te sale los términos de licencia...

PD: De verdad no se como la gente pregunta cosas de este tipo cuando esa información siempre está en la propia web del producto o en su software... en este caso y en todos los demás.

Saludos
8172  Programación / Scripting / Re: eliminar una linea en un batch en: 19 Septiembre 2013, 00:33 am
Primero tienes que averiguar el número de la linea (usando el comando FIND), y luego podrías usar este script para reemplazar la línea entera:

By Elektro H@cker[APORTE] Rutina TEXTMAN para manipular archivos de texto

saludos
8173  Programación / Scripting / Re: [BATCH] Duda en: 18 Septiembre 2013, 18:40 pm
A mi me funcionan bien los tres, quizás tuviste un problema de conexión con el foro justo en ese momento, intenta de nuevo...

de todas formas no creo que cueste mucho abrir el primer enlace e ir bajando el post hasta los otros 2 puntos que he citado -.-

Saludos!
8174  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 18 Septiembre 2013, 15:25 pm
· FileSize Converter

Convierte tamaños de unidades de almacenamiento

Código
  1. #Region " FileSize Converter "
  2.  
  3.    ' [ FileSize Converter Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.        ' MsgBox(String.Format("92928374 bytes = {0} Bytes", FileSize_Converter(92928374, Units.bytes, Units.bytes).ToString("n0"))) ' Result: 92.928.374,00 Bytes
  10.        ' MsgBox(String.Format("92928374 bytes = {0} KB", FileSize_Converter(92928374, Units.bytes, Units.kilobyte).ToString("n2"))) ' Result: 90.750,37 KB
  11.        ' MsgBox(String.Format("92928374 bytes = {0} MB", FileSize_Converter(92928374, Units.bytes, Units.megabyte).ToString("n2"))) ' Result: 88,62 MB
  12.        ' MsgBox(String.Format("50 GB = {0} Bytes", FileSize_Converter(50, Units.gigabyte, Units.bytes).ToString("n2"))) ' Result: 53.687.091.200,00 Bytes
  13.        ' MsgBox(String.Format("50 GB = {0} KB", FileSize_Converter(50, Units.gigabyte, Units.kilobyte).ToString("n2"))) ' Result: 52.428.800,00 KB
  14.        ' MsgBox(String.Format("50 GB = {0} MB", FileSize_Converter(50, Units.gigabyte, Units.megabyte).ToString("n2"))) ' Result: 51,200,00 MB
  15.  
  16.    Enum Units As Long
  17.        bytes = 1L
  18.        kilobyte = 1024L
  19.        megabyte = 1048576L
  20.        gigabyte = 1073741824L
  21.        terabyte = 1099511627776L
  22.        petabyte = 1125899906842624L
  23.    End Enum
  24.  
  25.    Private Function FileSize_Converter(ByVal Size As Long, _
  26.                                  ByVal FromUnit As Units, _
  27.                                  ByVal ToUnit As Units) As Double
  28.  
  29.        Dim bytes As Double = Convert.ToDouble(Size * FromUnit)
  30.        Dim result As Double = 0
  31.  
  32.        If ToUnit < FromUnit Then
  33.  
  34.            Select Case ToUnit
  35.                Case Units.bytes : result = bytes
  36.                Case Units.kilobyte : result = bytes / Units.kilobyte
  37.                Case Units.megabyte : result = bytes / Units.megabyte
  38.                Case Units.gigabyte : result = bytes / Units.gigabyte
  39.                Case Units.terabyte : result = bytes / Units.terabyte
  40.                Case Units.petabyte : result = bytes / Units.petabyte
  41.                Case Else : Return -1
  42.            End Select
  43.  
  44.        ElseIf ToUnit > FromUnit Then
  45.  
  46.            Select Case ToUnit
  47.                Case Units.bytes : result = bytes
  48.                Case Units.kilobyte : result = bytes * Units.kilobyte / Units.kilobyte ^ 2
  49.                Case Units.megabyte : result = bytes * Units.megabyte / Units.megabyte ^ 2
  50.                Case Units.gigabyte : result = bytes * Units.gigabyte / Units.gigabyte ^ 2
  51.                Case Units.terabyte : result = bytes * Units.terabyte / Units.terabyte ^ 2
  52.                Case Units.petabyte : result = bytes * Units.petabyte / Units.petabyte ^ 2
  53.                Case Else : Return -1
  54.            End Select
  55.  
  56.        ElseIf ToUnit = FromUnit Then
  57.  
  58.            result = Size
  59.  
  60.        End If
  61.  
  62.        Return result
  63.  
  64.    End Function
  65.  
  66. #End Region
  67.  
8175  Programación / Scripting / Re: Personalizar Batch en: 18 Septiembre 2013, 12:39 pm
Código
  1. @Echo OFF
  2. Setlocal EnableDelayedExpansion
  3.  
  4. Call :ToWordCase "hello world"
  5.  
  6. Pause&Exit
  7.  
  8. :ToWordCase
  9. Set "Alphabet=ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  10.  
  11. For %%# in (%~1) do (
  12. Set "Word=%%#"
  13. Set "Char=!Word:~0,1!"
  14. If "!Char!" EQU "a" (Set "X=%Alphabet:~0,1%")
  15. If "!Char!" EQU "b" (Set "X=%Alphabet:~1,1%")
  16. If "!Char!" EQU "c" (Set "X=%Alphabet:~2,1%")
  17. If "!Char!" EQU "d" (Set "X=%Alphabet:~3,1%")
  18. If "!Char!" EQU "e" (Set "X=%Alphabet:~4,1%")
  19. If "!Char!" EQU "f" (Set "X=%Alphabet:~5,1%")
  20. If "!Char!" EQU "g" (Set "X=%Alphabet:~6,1%")
  21. If "!Char!" EQU "h" (Set "X=%Alphabet:~7,1%")
  22. If "!Char!" EQU "i" (Set "X=%Alphabet:~8,1%")
  23. If "!Char!" EQU "j" (Set "X=%Alphabet:~9,1%")
  24. If "!Char!" EQU "k" (Set "X=%Alphabet:~10,1%")
  25. If "!Char!" EQU "l" (Set "X=%Alphabet:~11,1%")
  26. If "!Char!" EQU "m" (Set "X=%Alphabet:~12,1%")
  27. If "!Char!" EQU "n" (Set "X=%Alphabet:~13,1%")
  28. If "!Char!" EQU "o" (Set "X=%Alphabet:~14,1%")
  29. If "!Char!" EQU "p" (Set "X=%Alphabet:~15,1%")
  30. If "!Char!" EQU "q" (Set "X=%Alphabet:~16,1%")
  31. If "!Char!" EQU "r" (Set "X=%Alphabet:~17,1%")
  32. If "!Char!" EQU "s" (Set "X=%Alphabet:~18,1%")
  33. If "!Char!" EQU "t" (Set "X=%Alphabet:~19,1%")
  34. If "!Char!" EQU "u" (Set "X=%Alphabet:~20,1%")
  35. If "!Char!" EQU "v" (Set "X=%Alphabet:~21,1%")
  36. If "!Char!" EQU "w" (Set "X=%Alphabet:~22,1%")
  37. If "!Char!" EQU "x" (Set "X=%Alphabet:~23,1%")
  38. If "!Char!" EQU "y" (Set "X=%Alphabet:~24,1%")
  39. If "!Char!" EQU "z" (Set "X=%Alphabet:~25,1%")
  40. < Nul Call Set /P "=!X!!Word:~1! "
  41. )
  42.  
  43. GOTO:EOF

Así lo hice en Batch,
saludos!
8176  Programación / Scripting / Re: Cambiar separador de campo en: 18 Septiembre 2013, 12:04 pm
Te aconsejo que utilices un lenguaje con soporte para reemplazar mediante expresiones regulares (es decir, cualquier otro lenguaje menos Batch).

Código:
(\s{1})[^.]

Puedes utilizar el subgrupo 1 de ese RegEx.

Saludos!
8177  Programación / Scripting / Re: Personalizar Batch en: 17 Septiembre 2013, 23:52 pm
A veces, cuando pongo el nombre, por ejemplo Juan, me abre la carpeta de mis documentos, la cierro y ejecuto de nuevo, poniendo el mismo nombre y es a la segunda cuando funciona.

Si eso es así entonces puede que estés creando la carpeta después de llamar al explorer y no antes?

Lo de incrementar el sufijo del nombre de la carpeta, sólamente tienes que hacer un substring, es muy sencillo: http://ss64.com/nt/syntax-substring.html

hoy no tengo mas tiempo, si no se me adelanta algún compañero mañana te muestro lo de poner las letras en WordCase, que eso requiere un poco más de elaboración.

Saludos
8178  Programación / Programación General / Re: Ayuda xcopy batch en: 17 Septiembre 2013, 23:11 pm
Es culpa mía, que hoy estoy un poco espeso, disculpa, Xcopy pide multiples confirmaciones...

Puedes usar el sistema de exclusiones del comando XCopy, aunque es una mierd@ de sistema hablando en claro y muy limitado:

Código
  1. @Echo OFF
  2.  
  3. Set "Dir1=D:\Directorio1"
  4. Set "Dir2=D:\Directorio2"
  5.  
  6. PUSHD "%Dir2%"
  7. (For /R %%# in ("*") do (Echo %%~nx#))>>"%~dp0Exclude.txt"
  8.  
  9. XCOPY /E /-Y "%Dir1%\*" "%Dir2%\" /EXCLUDE:Exclude.txt
  10.  
  11. DEL /Q "Exclude.txt"
  12. Pause&Exit





Otra alternativa es hacer esto, queda bastante feo, y limitado (a la cantidad de "N"), pero si no necesitas copiar muchos archivos entonces te funcionará:

Código
  1. @Echo OFF
  2.  
  3. Echo NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN|(
  4. XCOPY /E /-Y "D:\DIRECTORIO\1\*" "D:\DIRECTORIO\\2\"
  5. )
  6.  
  7. Pause&Exit

Saludos
8179  Programación / Programación General / Re: Ayuda xcopy batch en: 17 Septiembre 2013, 21:24 pm
nose donde ponerle el

Código:
 Echo N|

Lo tienes que poner a la izquierda, tal y como te mostré en mi ejemplo,
piensa que la salida del comando (una "N") se lo quieres pasar al comando que hay después de la pipe "|", no al revés.

Código
  1. Echo N|XCOPY /E /-Y "D:\Escritorio\1\*" "D:\Escritorio\2\"

PD: Usa las comillas dobles siempre sobretodo cuando trabajes con directorios, son muy importantes.

Saludos!

8180  Programación / Programación General / Re: Ayuda xcopy batch en: 17 Septiembre 2013, 21:09 pm
sabes que estoy probando y no me sale...

me lo cierra directamente o tira error de la forma que prueve ponerlo...

Muestra tu código, estás cometiendo algún error de sintaxis

saludos!
Páginas: 1 ... 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 [818] 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines