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

 

 


Tema destacado: Como proteger una cartera - billetera de Bitcoin


  Mostrar Mensajes
Páginas: 1 ... 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 [1138] 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 ... 1236
11371  Programación / Scripting / Re: PROBLEMA CON UN PROGRAMA EN BATCH en: 31 Marzo 2012, 19:40 pm
lo que dijistes sobre redireccionar no lo he entendido :-\ :D

Esto te servirá: http://ss64.com/nt/syntax-redirection.html

Te pongo otro ejemplo:

Código
  1. @Echo off
  2. Echo: Este comando muestra el error: | More
  3. Echo: Type sfhiushiuf.txt | More
  4. Type sfhiushiuf.txt
  5.  
  6. Cls
  7. Echo: En cambio ahora ya no muestra error: | More
  8. Echo: Type sfhiushiuf.txt | More
  9. Type sfhiushiuf.txt 2>Nul

Salu2.


EDITO:

Por cierto fíjate en esta línea del code que posteaste:
Código
  1. >>>>>>>>>>>>>>>>AÑADIR DE SISTEMA<<<<<<<<<<<<<<<<<<<<

No creo que de problemas ya que está entre una llamada a una etiqueta y una etiqueta, Pero por precaución la dejaría como el resto:
Código
  1. ::>>>>>>>>>>>>>>>>AÑADIR DE SISTEMA<<<<<<<<<<<<<<<<<<<<


Además, deja esto así:
Código
  1. set/p file=
  2. Set File=%File:"=%

Y en donde pones %File% cambialos por "%File%".
11372  Programación / Scripting / Re: reemplasar una cadena de numeros con bat en: 31 Marzo 2012, 17:56 pm
Con esto podrás convertir bytes a mb.
[Batch] [Ruby] Ctool (Convertidor de unidades Bytes, KB, MB, GB, TB y PB)

Salu2.

PD: Si no quieres usar un comando externo, También puedes hacerlo por VBScript.
11373  Programación / Scripting / [Batch] [Ruby] Ctool (Convertidor de unidades Bytes, KB, MB, GB, TB y PB) en: 31 Marzo 2012, 17:52 pm


Una utilidad por linea de comandos para convertir entre bytes, kilobytes, megabytes, gigabytes, terabytes, y petabytes.

Citar
Como usarlo:
Código:
CTool.exe {Tamaño} {Unidad} {A unidad}
  Las unidades son: Bytes, KB, MB, GB, TB, PB.

 Ejemplos:

  - Convertir bytes a megabytes:
Código:
CTool 446.777.647.104 Bytes MB

  - Convertir megabytes a kilobytes:
Código:
CTool 44.33 MB KB

  - Convertir petabyte a todas las unidades:
Código:
CTool 1 PB

Algunas imagenes:

   

- El script convertido a EXE:



- Un ejemplo de uso en Batch, Para averiguar el espacio libre en el disco duro:
Código
  1. @Echo OFF
  2. For /f "tokens=3 delims= " %%# in ('Dir ^| find "libres"') do (Set "Bytes=%%#")
  3. For /f "tokens=2 delims==" %%# in ('Ctool %bytes% bytes gb ^| Find "="') do (Echo: Espacio libre en %Homedrive%%%#)

- El script, Codeado en Ruby:
  PD: Quizás no me ha quedado muy "bonito", Repito bastantes cosas que se podrian simplificar xD pero no estoy por la labor de hacerlo, Así como está ya funciona xD.

Código
  1. # -*- coding: UTF-8 -*-
  2.  
  3. # Conversion Tool v0.1
  4. # By Elektro H@cker
  5.  
  6. exit if Object.const_defined?(:Ocra)
  7.  
  8. def logo()
  9. puts "
  10.  _______  _______                __
  11. |   _   ||       |.-----..-----.|  |
  12. |.  1___||.|   | ||  _  ||  _  ||  |
  13. |.  |___ `-|.  |-'|_____||_____||__|
  14. |:  1   |  |:  |
  15. |::.. . |  |::.|    Conversion
  16. `-------'  `---'       Tool
  17.  
  18.  
  19. "
  20. end
  21.  
  22. def help()
  23. print "
  24. How to use it:
  25.  
  26.   #{__FILE__.split('/').last.split('.').first}.exe {Size} {Unit} {To unit}
  27.  
  28.   Units are: Bytes, KB, MB, GB, TB, PB.
  29.  
  30.  
  31. Examples:
  32.  
  33.  - Convert bytes to megabytes:
  34.  
  35.    #{__FILE__.split('/').last.split('.').first}.exe 446.777.647.104 Bytes MB
  36.  
  37.  - Convert megabytes to kilobytes:
  38.  
  39.    #{__FILE__.split('/').last.split('.').first}.exe 44.33 MB KB
  40.  
  41.  - Convert petabyte to all:
  42.  
  43.    #{__FILE__.split('/').last.split('.').first}.exe 1 PB
  44.  
  45. "
  46. Process.exit
  47. end
  48.  
  49. def BytesToUnit (number)
  50.  
  51.  @KILOBYTE   = 1024.0
  52.  @MEGABYTE = 1024.0 * 1024.0
  53.  @GIGABYTE  = 1024.0 * 1024.0 * 1024.0
  54.  @TERABYTE  = 1024.0 * 1024.0 * 1024.0 * 1024.0
  55.  @PETABYTE  = 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0
  56.  
  57. @Bytes = number.to_s + " Bytes"
  58.  
  59. @Kilos = (number / @KILOBYTE).to_s
  60.  if number.to_s.length > 20 and @Kilos.length > 3 and @Kilos.split('.').first.length == 1
  61.    @Kilos = "KB too depth"
  62.  elsif  not @Kilos.include? "-" and not @Kilos[0..3].eql? "0.00"
  63.     @Kilos = @Kilos.split('.').first + "." + @Kilos.split('.').last[0..1] + " KB"
  64.   elsif
  65.     @Kilos = "0.0 KB".to_s
  66.  end # Kilos
  67.  
  68. @Megas = (number / @MEGABYTE).to_s
  69.  if number.to_s.length > 20 and @Megas.length > 3 and @Megas.split('.').first.length == 1
  70.    @Megas = "MB too depth"
  71.  elsif  not @Megas.include? "-" and not @Megas[0..3].eql? "0.00"
  72.     @Megas = @Megas.split('.').first + "." + @Megas.split('.').last[0..1] + " MB"
  73.   elsif
  74.     @Megas = "0.0 MB".to_s
  75.   end # Megas
  76.  
  77. @Gigas = (number / @GIGABYTE).to_s
  78.  if number.to_s.length > 20 and @Gigas.length > 3 and @Gigas.split('.').first.length == 1
  79.    @Gigas = "GB too depth"
  80.  elsif not @Gigas.include? "-"
  81.     @Gigas = @Gigas.split('.').first + "." + @Gigas.split('.').last[0..1] + " GB"
  82.   elsif
  83.     @Gigas = "0.0 GB".to_s
  84.   end # Gigas
  85.  
  86. @Teras = (number / @TERABYTE).to_s
  87.  if number.to_s.length > 20 and @Teras.length > 3 and @Teras.split('.').first.length == 1
  88.    @Teras = "TB too depth"
  89.  elsif not @Teras.include? "-"
  90.     @Teras = @Teras.split('.').first + "." + @Teras.split('.').last[0..1] + " TB"
  91.   elsif
  92.     @Teras = "0.0 TB".to_s
  93.   end # Teras
  94.  
  95. @Petas = (number / @PETABYTE).to_s
  96.  if number.to_s.length > 20 and @Petas.length > 3 and @Petas.split('.').first.length == 1
  97.    @Petas = "PB too depth"
  98.  elsif not @Petas.include? "-"
  99.     @Petas = @Petas.split('.').first + "." + @Petas.split('.').last[0..1] + " PB"
  100.   elsif
  101.     @Petas = "0.0 PB".to_s
  102.   end # Petas
  103. end
  104.  
  105. def KBToUnit (number)
  106.  
  107.  @BYTE           = 1024.0
  108.  @MEGABYTE = 1024.0
  109.  @GIGABYTE  = 1024.0 * 1024.0
  110.  @TERABYTE  = 1024.0 * 1024.0 * 1024.0
  111.  @PETABYTE  = 1024.0 * 1024.0 * 1024.0 * 1024.0
  112.  
  113. @Bytes = (number * @BYTE).to_s
  114.  if number.to_s.length > 20 and @Bytes.length > 3 and @Bytes.split('.').first.length == 1
  115.    @Bytes = "Bytes too depth"
  116.  elsif @Bytes[0..2].eql? "0.0"
  117.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0..1] + " Bytes"
  118.  elsif
  119.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0] + " Bytes"
  120.  end # Bytes
  121.  
  122. @Kilos = number.to_s + " KB"
  123.  
  124. @Megas = (number / @MEGABYTE).to_s
  125.  if number.to_s.length > 20 and @Megas.length > 3 and @Megas.split('.').first.length == 1
  126.    @Megas = "MB too depth"
  127.  elsif  not @Megas.include? "-" and not @Megas[0..3].eql? "0.00"
  128.     @Megas = @Megas.split('.').first + "." + @Megas.split('.').last[0..1] + " MB"
  129.   elsif
  130.     @Megas = "0.0 MB".to_s
  131.   end # Megas
  132.  
  133. @Gigas = (number / @GIGABYTE).to_s
  134.  if number.to_s.length > 20 and @Gigas.length > 3 and @Gigas.split('.').first.length == 1
  135.    @Gigas = "GB too depth"
  136.  elsif not @Gigas.include? "-"
  137.     @Gigas = @Gigas.split('.').first + "." + @Gigas.split('.').last[0..1] + " GB"
  138.   elsif
  139.     @Gigas = "0.0 GB".to_s
  140.   end # Gigas
  141.  
  142. @Teras = (number / @TERABYTE).to_s
  143.  if number.to_s.length > 20 and @Teras.length > 3 and @Teras.split('.').first.length == 1
  144.    @Teras = "TB too depth"
  145.  elsif not @Teras.include? "-"
  146.     @Teras = @Teras.split('.').first + "." + @Teras.split('.').last[0..1] + " TB"
  147.   elsif
  148.     @Teras = "0.0 TB".to_s
  149.   end # Teras
  150.  
  151. @Petas = (number / @PETABYTE).to_s
  152.  if number.to_s.length > 20 and @Petas.length > 3 and @Petas.split('.').first.length == 1
  153.    @Petas = "PB too depth"
  154.  elsif not @Petas.include? "-"
  155.     @Petas = @Petas.split('.').first + "." + @Petas.split('.').last[0..1] + " PB"
  156.   elsif
  157.     @Petas = "0.0 PB".to_s
  158.   end # Petas
  159. end
  160.  
  161. def MBToUnit (number)
  162.  
  163.  @BYTE           = 1024.0 * 1024.0
  164.  @KILOBYTE   = 1024.0
  165.  @GIGABYTE  = 1024.0
  166.  @TERABYTE  = 1024.0 * 1024.0
  167.  @PETABYTE  = 1024.0 * 1024.0 * 1024.0
  168.  
  169. @Bytes = (number * @BYTE).to_s
  170.  if number.to_s.length > 20 and @Bytes.length > 3 and @Bytes.split('.').first.length == 1
  171.    @Bytes = "Bytes too depth"
  172.  elsif @Bytes[0..2].eql? "0.0"
  173.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0..1] + " Bytes"
  174.  elsif
  175.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0] + " Bytes"
  176.  end # Bytes
  177.  
  178. @Kilos = (number * @KILOBYTE).to_s
  179.  if number.to_s.length > 20 and @Kilos.length > 3 and @Kilos.split('.').first.length == 1
  180.    @Kilos = "KB too depth"
  181.  elsif  not @Kilos.include? "-" and not @Kilos[0..3].eql? "0.00"
  182.     @Kilos = @Kilos.split('.').first + "." + @Kilos.split('.').last[0..1] + " KB"
  183.   elsif
  184.     @Kilos = "0.0 KB".to_s
  185.  end # Kilos
  186.  
  187. @Megas = number.to_s + " MB"
  188.  
  189. @Gigas = (number / @GIGABYTE).to_s
  190.  if number.to_s.length > 20 and @Gigas.length > 3 and @Gigas.split('.').first.length == 1
  191.    @Gigas = "GB too depth"
  192.  elsif not @Gigas.include? "-"
  193.     @Gigas = @Gigas.split('.').first + "." + @Gigas.split('.').last[0..1] + " GB"
  194.   elsif
  195.     @Gigas = "0.0 GB".to_s
  196.   end # Gigas
  197.  
  198. @Teras = (number / @TERABYTE).to_s
  199.  if number.to_s.length > 20 and @Teras.length > 3 and @Teras.split('.').first.length == 1
  200.    @Teras = "TB too depth"
  201.  elsif not @Teras.include? "-"
  202.     @Teras = @Teras.split('.').first + "." + @Teras.split('.').last[0..1] + " TB"
  203.   elsif
  204.     @Teras = "0.0 TB".to_s
  205.   end # Teras
  206.  
  207. @Petas = (number / @PETABYTE).to_s
  208.  if number.to_s.length > 20 and @Petas.length > 3 and @Petas.split('.').first.length == 1
  209.    @Petas = "PB too depth"
  210.  elsif not @Petas.include? "-"
  211.     @Petas = @Petas.split('.').first + "." + @Petas.split('.').last[0..1] + " PB"
  212.   elsif
  213.     @Petas = "0.0 PB".to_s
  214.   end # Petas
  215. end
  216.  
  217. def GBToUnit (number)
  218.  
  219.  @BYTE           = 1024.0 * 1024.0 * 1024.0
  220.  @KILOBYTE   = 1024.0 * 1024.0
  221.  @MEGABYTE = 1024.0
  222.  @TERABYTE  = 1024.0
  223.  @PETABYTE  = 1024.0 * 1024.0
  224.  
  225. @Bytes = (number * @BYTE).to_s
  226.  if number.to_s.length > 20 and @Bytes.length > 3 and @Bytes.split('.').first.length == 1
  227.    @Bytes = "Bytes too depth"
  228.  elsif @Bytes[0..2].eql? "0.0"
  229.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0..1] + " Bytes"
  230.  elsif
  231.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0] + " Bytes"
  232.  end # Bytes
  233.  
  234. @Kilos = (number * @KILOBYTE).to_s
  235.  if number.to_s.length > 20 and @Kilos.length > 3 and @Kilos.split('.').first.length == 1
  236.    @Kilos = "KB too depth"
  237.  elsif  not @Kilos.include? "-" and not @Kilos[0..3].eql? "0.00"
  238.     @Kilos = @Kilos.split('.').first + "." + @Kilos.split('.').last[0..1] + " KB"
  239.   elsif
  240.     @Kilos = "0.0 KB".to_s
  241.  end # Kilos
  242.  
  243. @Megas = (number * @MEGABYTE).to_s
  244.  if number.to_s.length > 20 and @Megas.length > 3 and @Megas.split('.').first.length == 1
  245.    @Megas = "MB too depth"
  246.  elsif  not @Megas.include? "-" and not @Megas[0..3].eql? "0.00"
  247.     @Megas = @Megas.split('.').first + "." + @Megas.split('.').last[0..1] + " MB"
  248.   elsif
  249.     @Megas = "0.0 MB".to_s
  250.  end # Megas
  251.  
  252. @Gigas = number.to_s + " GB"
  253.  
  254. @Teras = (number / @TERABYTE).to_s
  255.  if number.to_s.length > 20 and @Teras.length > 3 and @Teras.split('.').first.length == 1
  256.    @Teras = "TB too depth"
  257.  elsif not @Teras.include? "-"
  258.     @Teras = @Teras.split('.').first + "." + @Teras.split('.').last[0..1] + " TB"
  259.   elsif
  260.     @Teras = "0.0 TB".to_s
  261.   end # Teras
  262.  
  263. @Petas = (number / @PETABYTE).to_s
  264.  if number.to_s.length > 20 and @Petas.length > 3 and @Petas.split('.').first.length == 1
  265.    @Petas = "PB too depth"
  266.  elsif not @Petas.include? "-"
  267.     @Petas = @Petas.split('.').first + "." + @Petas.split('.').last[0..1] + " PB"
  268.   elsif
  269.     @Petas = "0.0 PB".to_s
  270.   end # Petas
  271. end
  272.  
  273. def TBToUnit (number)
  274.  
  275.  @BYTE           = 1024.0 * 1024.0 * 1024.0 * 1024.0
  276.  @KILOBYTE   = 1024.0 * 1024.0 * 1024.0
  277.  @MEGABYTE = 1024.0 * 1024.0
  278.  @GIGABYTE  = 1024.0
  279.  @PETABYTE  = 1024.0
  280.  
  281. @Bytes = (number * @BYTE).to_s
  282.  if number.to_s.length > 20 and @Bytes.length > 3 and @Bytes.split('.').first.length == 1
  283.    @Bytes = "Bytes too depth"
  284.  elsif @Bytes[0..2].eql? "0.0"
  285.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0..1] + " Bytes"
  286.  elsif
  287.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0] + " Bytes"
  288.  end # Bytes
  289.  
  290. @Kilos = (number * @KILOBYTE).to_s
  291.  if number.to_s.length > 20 and @Kilos.length > 3 and @Kilos.split('.').first.length == 1
  292.    @Kilos = "KB too depth"
  293.  elsif  not @Kilos.include? "-" and not @Kilos[0..3].eql? "0.00"
  294.     @Kilos = @Kilos.split('.').first + "." + @Kilos.split('.').last[0..1] + " KB"
  295.   elsif
  296.     @Kilos = "0.0 KB".to_s
  297.  end # Kilos
  298.  
  299. @Megas = (number * @MEGABYTE).to_s
  300.  if number.to_s.length > 20 and @Megas.length > 3 and @Megas.split('.').first.length == 1
  301.    @Megas = "MB too depth"
  302.  elsif  not @Megas.include? "-" and not @Megas[0..3].eql? "0.00"
  303.     @Megas = @Megas.split('.').first + "." + @Megas.split('.').last[0..1] + " MB"
  304.   elsif
  305.     @Megas = "0.0 MB".to_s
  306.  end # Megas
  307.  
  308. @Gigas = (number * @GIGABYTE).to_s
  309.  if number.to_s.length > 20 and @Gigas.length > 3 and @Gigas.split('.').first.length == 1
  310.    @Gigas = "GB too depth"
  311.  elsif not @Gigas.include? "-"
  312.     @Gigas = @Gigas.split('.').first + "." + @Gigas.split('.').last[0..1] + " GB"
  313.   elsif
  314.     @Gigas = "0.0 GB".to_s
  315.   end # Gigas
  316.  
  317. @Teras = number.to_s + " TB"
  318.  
  319. @Petas = (number / @PETABYTE).to_s
  320.  if number.to_s.length > 20 and @Petas.length > 3 and @Petas.split('.').first.length == 1
  321.    @Petas = "PB too depth"
  322.  elsif not @Petas.include? "-"
  323.     @Petas = @Petas.split('.').first + "." + @Petas.split('.').last[0..1] + " PB"
  324.   elsif
  325.     @Petas = "0.0 PB".to_s
  326.   end # Petas
  327. end
  328.  
  329. def PBToUnit (number)
  330.  
  331.  @BYTE          = 1024.0 * 1024.0 * 1024.0 * 1024.0 * 1024.0
  332.  @KILOBYTE   = 1024.0 * 1024.0 * 1024.0 * 1024.0
  333.  @MEGABYTE = 1024.0 * 1024.0 * 1024.0
  334.  @GIGABYTE  = 1024.0 * 1024.0
  335.  @TERABYTE  = 1024.0
  336.  
  337. @Bytes = (number * @BYTE).to_s
  338.  if number.to_s.length > 20 and @Bytes.length > 3 and @Bytes.split('.').first.length == 1
  339.    @Bytes = "Bytes too depth"
  340.  elsif @Bytes[0..2].eql? "0.0"
  341.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0..1] + " Bytes"
  342.  elsif
  343.    @Bytes = @Bytes.split('.').first + "." + @Bytes.split('.').last[0] + " Bytes"
  344.  end # Bytes
  345.  
  346. @Kilos = (number * @KILOBYTE).to_s
  347.  if number.to_s.length > 20 and @Kilos.length > 3 and @Kilos.split('.').first.length == 1
  348.    @Kilos = "KB too depth"
  349.  elsif  not @Kilos.include? "-" and not @Kilos[0..3].eql? "0.00"
  350.     @Kilos = @Kilos.split('.').first + "." + @Kilos.split('.').last[0..1] + " KB"
  351.   elsif
  352.     @Kilos = "0.0 KB".to_s
  353.  end # Kilos
  354.  
  355. @Megas = (number * @MEGABYTE).to_s
  356.  if number.to_s.length > 20 and @Megas.length > 3 and @Megas.split('.').first.length == 1
  357.    @Megas = "MB too depth"
  358.  elsif  not @Megas.include? "-" and not @Megas[0..3].eql? "0.00"
  359.     @Megas = @Megas.split('.').first + "." + @Megas.split('.').last[0..1] + " MB"
  360.   elsif
  361.     @Megas = "0.0 MB".to_s
  362.  end # Megas
  363.  
  364. @Gigas = (number * @GIGABYTE).to_s
  365.  if number.to_s.length > 20 and @Gigas.length > 3 and @Gigas.split('.').first.length == 1
  366.    @Gigas = "GB too depth"
  367.  elsif not @Gigas.include? "-"
  368.     @Gigas = @Gigas.split('.').first + "." + @Gigas.split('.').last[0..1] + " GB"
  369.   elsif
  370.     @Gigas = "0.0 GB".to_s
  371.   end # Gigas
  372.  
  373. @Teras = (number * @TERABYTE).to_s
  374.  if number.to_s.length > 20 and @Teras.length > 3 and @Teras.split('.').first.length == 1
  375.    @Teras = "TB too depth"
  376.  elsif not @Teras.include? "-"
  377.     @Teras = @Teras.split('.').first + "." + @Teras.split('.').last[0..1] + " TB"
  378.   elsif
  379.     @Teras = "0.0 TB".to_s
  380.   end # Teras
  381.  
  382. @Petas = number.to_s + " PB"
  383. end
  384.  
  385. # Error control
  386. def args()
  387.  if ARGV.empty? or ARGV[0] == "/?" or ARGV[1] == nil  or ARGV[2] == nil and not ARGV[1] == "bytes" and not ARGV[1] == "Bytes" and not ARGV[1] == "BYTES" and not ARGV[1] == "kb" and not ARGV[1] == "Kb" and not ARGV[1] == "KB" and not ARGV[1] == "kB" and not ARGV[1] == "mb" and not ARGV[1] == "Mb" and not ARGV[1] == "MB" and not ARGV[1] == "mB" and not ARGV[1] == "gb" and not ARGV[1] == "gB" and not ARGV[1] == "Gb" and not ARGV[1] == "GB" and not ARGV[1] == "tb" and not ARGV[1] == "Tb" and not ARGV[1] == "TB" and not ARGV[1] == "tB" and not ARGV[1] == "pb" and not ARGV[1] == "pB" and not ARGV[1] == "Pb" and not ARGV[1] == "PB"
  388.    help()
  389.  elsif not ARGV[2] == "bytes" and not ARGV[2] == "Bytes" and not ARGV[2] == "BYTES" and not ARGV[2] == "kb" and not ARGV[2] == "Kb" and not ARGV[2] == "KB" and not ARGV[2] == "kB" and not ARGV[2] == "mb" and not ARGV[2] == "Mb" and not ARGV[2] == "MB" and not ARGV[2] == "mB" and not ARGV[2] == "gb" and not ARGV[2] == "gB" and not ARGV[2] == "Gb" and not ARGV[2] == "GB" and not ARGV[2] == "tb" and not ARGV[2] == "Tb" and not ARGV[2] == "TB" and not ARGV[2] == "tB" and not ARGV[2] == "pb" and not ARGV[2] == "pB" and not ARGV[2] == "Pb" and not ARGV[2] == "PB"
  390.    $ToUnit = "all"
  391.  end
  392. end
  393.  
  394. # Process
  395. logo()
  396. args()
  397.  
  398. input = ARGV[0]
  399. unit = ARGV[1]
  400. $ToUnit = ARGV[2]
  401.  
  402. input = input.gsub(',', '.')
  403.  
  404. if not input.length == 6 or not input.length == 5 and not input[-3] == "."
  405.  input = input.gsub('.', '')
  406.  input = input.to_i
  407. elsif
  408.  input = input.to_f
  409. end
  410.  
  411. if unit =~ /bytes/i
  412.  BytesToUnit(input)
  413. elsif unit =~ /kb/i
  414.  KBToUnit(input)
  415. elsif unit =~ /mb/i
  416.  MBToUnit(input)
  417. elsif unit =~ /gb/i
  418.  GBToUnit(input)
  419. elsif unit =~ /tb/i
  420.  TBToUnit(input)
  421. elsif unit =~ /pb/i
  422.  PBToUnit(input)
  423. end
  424.  
  425. if $ToUnit =~ /bytes/i
  426.  puts "#{input} #{unit} = #{@Bytes}"
  427. elsif $ToUnit =~ /kb/i
  428.  puts "#{input} #{unit} = #{@Kilos}"
  429. elsif $ToUnit =~ /mb/i
  430.  puts "#{input} #{unit} = #{@Megas}"
  431. elsif $ToUnit =~ /gb/i
  432.  puts "#{input} #{unit} = #{@Gigas}"
  433. elsif $ToUnit =~ /tb/i
  434.  puts "#{input} #{unit} = #{@Teras}"
  435. elsif $ToUnit =~ /pb/i
  436.  puts "#{input} #{unit} = #{@Petas}"
  437. elsif $ToUnit == nil
  438.  puts "#{input} #{unit} = #{@Bytes}"
  439.  puts "#{input} #{unit} = #{@Kilos}"
  440.  puts "#{input} #{unit} = #{@Megas}"
  441.  puts "#{input} #{unit} = #{@Gigas}"
  442.  puts "#{input} #{unit} = #{@Teras}"
  443.  puts "#{input} #{unit} = #{@Petas}"
  444. end
  445.  
  446. __END__
11374  Programación / Scripting / Re: PROBLEMA CON UN PROGRAMA EN BATCH en: 31 Marzo 2012, 05:35 am
Hola Xnyk0X96, Veo que eres nuevo en el foro, Pero la próxima vez usa las etiquetas de código  :P.

- Para modificar los atributos de un archivo oculto, Primero tienes que desocultarlo:

Código
  1. @Echo OFF
  2. Attrib +h test.txt
  3. Attrib -h +r test.txt
  4. Attrib +h test.txt

- Para evitar la salida de error de un comando, Dbes redireccionar.

Código
  1. @Echo OFF
  2. Dir qwerty 2>nul

Salu2.
11375  Sistemas Operativos / Windows / Re: Si borro carpetas no se borran los archivos dentro de ellas?? en: 31 Marzo 2012, 05:28 am
Esto es cierto???

Según el punto de vista de la pregunta.

 - Si borras una carpeta que contenga archivos, Los archivos también van a la papelera de reciclaje. Se borran.

 - Tanto si borras un archivo como una carpeta con archivos, Estos no se llegan a eliminar completamente del disco duro hasta que un nuevo archivo reemplaze su espacio en disco.

Salu2.

11376  Programación / Scripting / Re: [BATCH] [APORTE] MouseXY (Devuelve las coordenadas del mouse) en: 31 Marzo 2012, 02:19 am
no me andan esos links

Gracias por avisar, Lo resubo enseguida.

No se porque lo habrán borrado los de MF si el link lleva pocos días :/

Salu2.


EDITO: Listo.
11377  Programación / Scripting / Re: Problema con Comando para hacer fuerza bruta. en: 31 Marzo 2012, 00:28 am
Me tira este error ese programa: http://imageshack.us/f/651/errormnn.png/

La imagen sale pequeña, Pero el error es sobre .NET Framework.

Puntoinfinito sabrá la versión de la librería de Framework que requiere su programa, Pero deberías instalarte .NET Framwrok 4.0.


De todas formas, Aqui tienes una utilidad para sacar las coordenadas que no requiere .NET Framework: [BATCH] [APORTE] MouseXY (Devuelve las coordenadas del mouse)

Salu2.
11378  Programación / Scripting / Re: reemplasar una cadena de numeros con bat en: 31 Marzo 2012, 00:27 am
pero lo malo es que el espacio libre esta en bytes y lo quiero poner en Mb.

No es posible hacer la conversión de bytes a megabytes en Batch, Es limitado y no soporta operaciones de bits muy profundas.

Por esa regla de tres, Cualquier script que encuentres sobre el tema, en google, Va a ser un mal intento de conversion (Ya te lo digo yo, Que tube el mismo problema en su día).

La única alternativa que veo es que uses un programa de terceros para obtener el tamaño en MB o GB, Como por ejemplo el PSInfo:
Código:
psinfo -d

O crear tu mismo un code que haga la conversión (en cualquier lenguaje de scripting se puede).

PD: Quizás me pongo entre hoy y mañana a hacer una utilidad para hacer la conversión desde la CMD. Estoy haciendolo, Quizás te sirva. (No vas a encontrar otra manera en Batch xDDD) Ya avisaré :).

Salu2.
11379  Sistemas Operativos / Windows / Re: Claves WPA Registro de windows en: 30 Marzo 2012, 23:17 pm
estan en el registro, (HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/WZCSVC/Profiles/Interfaces);

Pides ayuda, Pero no das la información necesaria.

Di que tipo de clave es (multi sz, SZ, Binary, dword, qword...)
Di si el valor está en hexadecimal o decimal
Postea el contenido de la clave aquí.
Postea también el archivo de registro.

Con todo eso, Quizás se pueda o quizás no.

Salu2.

11380  Programación / Scripting / Re: [BATCH] Recopilatorio de herramientas CommandLine. (Actualizado el 30/03/2012) en: 30 Marzo 2012, 21:02 pm
Actualizado el 30/03/2012 por Elektro H@cker.

- Se han perdido muchos enlaces, Y muchas uilidades.

- Se ha resubido todo lo posible o se han añadido links de descarga oficiales a los programas.

- Se han añadido las siguientes utilidades a la lista en descarga directa:

 TinyUrl Shorter (Creado por Doddy) - Acortador de URLS.
 Pastebin Uploader (Creado por Doddy) - Sube archivos a Pastebin, desde la consola.

 Assoc7 (Creado por Elektro H@cker) - Asociador de tipos de archivo.
 ImagesHack Uploader (Creado por Elektro H@cker) - Sube imagenes a ImagesHack, desde la consola.
 MouseXY (Creado por Elektro H@cker) - Muestra las coordenadas del mouse.
 REG2BAT (Creado por Elektro H@cker) - Convierte archivos .REG a .BAT.
 Text Protector (Creado por Elektro H@cker) - Protege tus archivos de texto para que queden inteligibles.

 CRC32.exe - Comprueba el crcr32 de un archivo.
 Enigma - Encriptador de archivos.
 ExifTool- Edita y/o elimina la información exif de los archivos de imagen.
 Hex2Dec.exe - Convierte un número hexa a decimal.
 ID3 Mass Tagger - Edita y/o borra las id3v de archivos mp3.
 Irfanview.exe - Maipula archivos de imagen. Resize, crop, convert... etc.
 List DLLs - Muestra las dlls que está usando el sistema.
 NTFS Direct File Find - Un buscador de archivos.
 PSInfo.exe - Muestra información sobre el PC.
 SDelete - Elimina el espacio del disco duro.
 SetACL.exe - Edita los permisos de usuario del registro de Windows.
 Smart Drive Bckup - Crea un bacup de tus drivers.
 SOX.exe - Manipula archivos MP3. Cambiales la frequencia, el pitch, el bitdepth, etc....
 Subtitle Workshop - Edita archivos de subtítulos, Conviertelos a otro formato, etc...
 Uniq - Elimina lineas repetidas en un archivo de texto.
 Virus Total Uploader.exe - Sube archivos para que los analicen en VirusTotal.com.
 Wput.exe - Sube archivos a un FTP.

Salu2
Páginas: 1 ... 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 [1138] 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines