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

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Mensajes
Páginas: 1 ... 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 834 835 ... 1236
8191  Sistemas Operativos / Windows / [APORTE] Tips interesantes que deberías conocer para exprimir Windows 8 en: 16 Septiembre 2013, 19:12 pm
· Mostrar confirmación al enviar archivos a la papelera de reciclaje


· Descripción:

Por defecto en Windows 8 los archivos se eliminan sin pedir confirmación, para gente despistada o manazas esto puede ser un serio problema.


· Instrucciones:

Ejecutar estos comandos diréctamente en consola:

Código
  1. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V "ConfirmFileDelete" /T "REG_DWORD" /D "0x00000001" /F
  2. REG DELETE "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V "ConfirmFileDelete" /F





· Desactivar el límite de selección de 15 archivos.


· Descripción:

Cuando seleccionamos más de 15 archivos en el explorador de Windows la mayoría de las opciones del menú contextual desaparecen, si alguna vez te has preguntado porque, es por un límite que tiene impuesto el Sistema operativo.


· Instrucciones:

Ejecutar este comando diréctamente en consola:

Código
  1. REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer" /V "MultipleInvokePromptMinimum" /T "REG_DWORD" /D "0x00002710" /F





· Activar el Modo Dios (GodMode) en el Panel de control


· Descripción:

El Modo Dios no es más que una lista de todas las posibles tareas que puedes realizar, es más o menos como una vista en modo detalles de cada opción de cada grupo del panel de control.


· Instrucciones:

Ejecutar estos comandos diréctamente en consola:

Código
  1. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}" /V  "" /D ".: Modo Dios :." /F
  2. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}" /V "InfoTip" /T "REG_SZ" /D "Todo lo que Dios puede hacer..." /F
  3. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}" /V "System.ControlPanel.Category" /T "REG_SZ" /D "5" /F
  4. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}\DefaultIcon" /V  "" /D "%%SystemRoot%%\\System32\\imageres.dll,-27" /F
  5. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}\Shell\Open\Command" /V  "" /D "explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}" /F
  6. REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ControlPanel\NameSpace\{D15ED2E1-C75B-443c-BD7C-FC03B2F08C17}" /V  "" /D ".: Modo Dios :." /F





· Establecer una código de páginas predeterminado para la CMD


· Descripción:

Un código de página es una codificación o serie de caracteres para un país en particular.
Windows está diseñado para usarse en varios lenguajes y por eso Microsoft inventó los códigos de página (también llamados CodePages) de Windows hace más de dos décadas.

La gente que suele usar Batch, los Batcheros, sobre todo los que se introducen en el lenguaje muchas veces tienen problemas con los caracteres latinos, y no saben porqué ni como solucionarlo, hay varias maneras, pero yo te mustro la más sencilla.


· Instrucciones:

Ejecutar este comando diréctamente en consola:

Código
  1. REG ADD "HKCU\Software\Microsoft\Command Processor" /V "Autorun" /T "REG_SZ" /D "CHCP 1252 1>NUL" /F

NOTA: Si necesitan usar el CodePage por defecto de Windows, recuerden que es el 850.





· Establecer el modo de edición rápida para la CMD


· Descripción:

El modo de edición rápida es una característica que te permite copiar y pegar en la cmd o desde la cmd usando el mouse, esto puede agilizar mucho la tarea.


· Instrucciones:

Guardar el siguiente comando en un archivo .bat y ejecutarlo, si quieren ejecutarlo diréctamente desde la consola deben eliminar los escapes "^":

Código
  1. REG ADD HKCU\Console\^%%SystemRoot^%%_system32_cmd.exe /V "QuickEdit" /T "REG_DWORD" /D "0x00000001" /F





· Deshabilitar la Hibernación de Windows (y eliminar el archivo hibersys)


· Descripción:

Creo que todos sabemos que es el modo hibernación de Windows.


· Instrucciones:

Ejecutar estos comandos diréctamente en consola:

Código:
powercfg -h off





· Desactivar la animación GUI del Boot


· Descripción:

Si usas Windows 8 ya te habrás fijado que al prender el PC sale una animación con bolitas blancas que no paran de dar vueltas en circulos,
aquí te muestro como desactivar la animación para evitar sufrir paranoias mentales, ataques de psicosis, y epilepsia de tercer grado.


· Instrucciones:

Ejecutar estos comandos diréctamente en consola:

Código
  1. bcdedit /set {current} quietboot Yes

NOTA: No, por desgracia esto no desactiva la horrible imagen estática del logo de Windows.





· Deshabilitar el contador de intentos fallidos de login


· Descripción:

Windows 8 dispone de algunas medidas exhaustivas para molestar a los pobres usuarios malintencionados que quieren acceder a nuestra cuenta de usuario sin nuestor permiso...

...Una de esas medidas es un contador de intentos fallidos de sesión junto a un bloqueo temporal completo de nuestra cuenta de usuario.

Si crees que no necesitas tanta proteccion entonces puedes desactivar toda o parte de esa porquería.


· Instrucciones:

Ejecutar estos comandos diréctamente en consola:

Código
  1. Echo [+] Desactivar el contador del tiempo de bloqueo de cuenta de usuario
  2. net accounts /lockoutwindow:0
  3.  
  4. Echo [+] Desactivar la duración de bloqueo de cuenta de usuario
  5. net accounts /lockoutduration:0
  6.  
  7. Echo [+] Desactivar el contador de intentos inválidos de acceso de cuenta de usuario
  8. net accounts /lockoutthreshold:999





· Deshabilitar la característica AutoPlay de Windows


· Descripción:

AutoPlay es una característica multimedia que inicia automáticamente los menus de los CD's o te pregunta que hacer en cada caso, si te parece una molestia o un riesgo de virus, peudes desactivarlo.


· Instrucciones:

Ejecutar estos comandos diréctamente en la CMD:

Código
  1. REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" /V "NoDriveTypeAutoRun”" /T "REG_DWORD" /D "0x00000001" /F
  2. REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers" /V "DisableAutoplay" /T "REG_DWORD" /D "0x00000001" /F





· Añadir opciones para bootear en Modo Seguro en el Boot Loader de windows


· Descripción:

Las opciones de Modo Seguro son unas opciones especiales para iniciar Windows cargando únicamente los componentes más básicos y esenciales del sistema,
el modo seguro se suele utilizar para realizar reparaciones catastróficas del sistema operativo, como eliminar virus, o hacer pruebas del estado de Red.






· Instrucciones:

Guardar el siguiente script en un archivo .bat y ejecutarlo:

Código:
@Echo Off & SetLocal EnableDelayedExpansion




REM By Elektro H@cker




::: Customize your safe mode names here:
:::
Set "SafeMode_Description=Windows 8 Modo Seguro"
Set "SafeModeNetrowk_Description=Windows 8 Modo Seguro con funciones de Red"
Set "SafeModeShell_Description=Windows 8 Modo Seguro con Consola"
:::

(
Bcdedit /Enum /V | FINDSTR /I "^Descrip" | FIND /I "%SafeMode_Description%" 1>NUL
) || (
Bcdedit /Copy {current} /D "%SafeMode_Description%" 1>NUL
)

(
Bcdedit /Enum /V | FINDSTR /I "^Descrip" | FIND /I "%SafeModeNetrowk_Description%" 1>NUL
) || (
Bcdedit /Copy {current} /D "%SafeModeNetrowk_Description%" 1>NUL
)

(
Bcdedit /Enum /V | FINDSTR /I "^Descrip" | FIND /I "%SafeModeShell_Description%" 1>NUL
) || (
Bcdedit /Copy {current} /D "%SafeModeShell_Description%" 1>NUL
)

For /F "Tokens=2" %%# in (
'Bcdedit /Enum /V ^| FINDSTR /I "^Identif"'
) do (
SET /A ID_INDEX+=1
Set "ID!ID_INDEX!=%%#"
)

For /F "Tokens=1,*" %%A in (
'Bcdedit /Enum /V ^| FINDSTR /I "^Descrip"'
) do (
SET /A DES_INDEX+=1
Set "DES!DES_INDEX!=%%B"
)

For /L %%X in (1, 1, %ID_INDEX%) do (

If /I "!DES%%X!" EQU "%SafeMode_Description%" (
Bcdedit /Set "!ID%%X!" safeboot Minimal 1>NUL
Bcdedit /Set "!ID%%X!" quietboot Yes    1>NUL
)

If /I "!DES%%X!" EQU "%SafeModeNetrowk_Description%" (
Bcdedit /Set "!ID%%X!" safeboot Network 1>NUL
Bcdedit /Set "!ID%%X!" quietboot Yes    1>NUL
)

If /I "!DES%%X!" EQU "%SafeModeShell_Description%" (
Bcdedit /Set "!ID%%X!" safeboot Minimal           1>NUL
Bcdedit /Set "!ID%%X!" safebootalternateshell Yes 1>NUL
Bcdedit /Set "!ID%%X!" quietboot Yes              1>NUL
)

)

SetLocal DisableDelayedExpansion

TIMEOUT /T 3
Exit






Si les han gustado los "trucos" debo comentarles que conozco muchos más, pero no he querido llenar este post con otros "trucos" que ya he mencionado y compartido a lo largo de todos los años que llevo desmantelando los entresijos de Windows, pero aquí pueden encontrar algunos "Tips" más:

Recopilación Windows 8 (Programas, tips y guías) (Actualizado el 05/11/2012)

Que lo disfruten!
8192  Programación / Scripting / Re: Acciones sobre archivos de texto. [Batch] en: 16 Septiembre 2013, 17:28 pm
Lo que yo no entiendo es: ¿En la carpeta "Extensiones" deben ir todos los archivos sin importar la extension?, si fuese así entonces que le encuentras de beneficioso?, sería simplemente una copia nula (tamaño cero) de los mismo archivos.

¿O acaso quieres un txt por cada extension?, dentro de la carpeta "Extensiones".

Hice este código que genera una carpeta "Extensiones" por cada directorio y subdirectorio, dentro de la carpeta "Extensiones" se genera una serie de archivos "LOG" con el nombre de cada extension (Ejemplo: .avi.log), y dentro de cada archivo log están registrados los archivos de dicha extension.

Código
  1. @Echo OFF
  2. REM By Elektro H@cker
  3.  
  4. Set "Extensions="
  5.  
  6. :: No usar FOR /D /R para no crear conflictos en tiempo de ejecución entre el otro FOR al procesar carpetas.
  7. For /F "Delims=" %%D in ('DIR /B /S /AD "%CD%\*"') Do (Call :List "%%D")
  8. Echo [+] Terminado!
  9. Pause&Exit
  10.  
  11. :List
  12. Echo Procesando directorio "%~1"
  13. MKDIR "%~1\Extensiones" 2>NUL
  14.  
  15. FOR %%IN ("%~1\*.*") DO (
  16. Call Echo "%%Extensions%%!!|%%~x€" 1>NUL || (
  17. Call Set "Extensions=%%Extensions%%!!%%~x€"
  18. Echo Procesando archivos "%%~x€"
  19. (FOR %%# IN ("*%%~x€") DO (Echo %%#))>"%~1\Extensiones\%%~x€.log"
  20. )
  21. )
  22.  
  23. Echo+ | MORE
  24. Set "Extensions="
  25. GOTO:EOF

Saludos

8193  Foros Generales / Foro Libre / Re: Los creyentes son menos inteligentes que los ateos, según un estudio en: 16 Septiembre 2013, 17:21 pm
O te crees que si vas a echar abajo una torre y gritar allah es grande, te van a esperar en el cielo con 72 vírgenes?  :rolleyes:

Tienes toda la razón, y eso es lo más patético de todas las religiones, los supuestos regalos, en este caso los regalos carnales.

Solo hay que atar cabos y no ser estúpido, ¿Que es lo que más nos gusta a los hombres? ...las mujeres, ¿o no?, pues claro, ellos te dicen que en el cielo te van a esperar 72 virgenes para que tengas muuucho sexo con ellas, en otras religiones te dicen que encontrarás felicidad eterna, o a tus seres queridos, etc... en fin, son cosas que todo el mundo desea... y con esos regalos compran a los menos inteligentes o más manipulables (Lease: Religiosos).

Un saludo!
8194  Foros Generales / Foro Libre / Re: Éste es el servicio de emergencias en España? en: 16 Septiembre 2013, 17:13 pm
Tardaron unos 15 minutos en venir. El bar estaba a 400 metros del hospital...

Teniendo en cuenta que BCN es la ciudad con más tráfico de vehículos de España... (o al menos yo la considero así).

No me parece sorprendente el caso de la viejecilla si es que estamos hablando de Barna o cercanias no se le puede pedir mucho más a los de Urgencias, yo también he estado en Barcelona, varias veces, en días festivos y en días normales, puedo decir que Barcelona es la ciudad del caos del tráfico, Madrid no tanto la verdad, me da bastante asco andar por esas calles de Barna con tanto ruido y contaminación la verdad (y eso que vivo en Valencia capital, que también tiene tela!, pero no se puede comparar)

Estoy seguro que en ciudades menos superpobladas la media de tiempo estimado para que Urgencias llegue al sitio en cuestión debe ser de unos 4-5 minutos, ah no ser que pille en carreteras o autopistas xD claro....

Saludos!
8195  Sistemas Operativos / Windows / Re: [APORTE] Menu en cascada para Windows 8 - Permisos de usuario en: 16 Septiembre 2013, 16:50 pm
El 64 es el que use, el 32 no es compatible.
Lo probé en Windows 8

Gracias por avisar, esto me pasa por no querer limitar lo que comparto sólamente a los 64 Bit, pero cuando me pongo a hacer las dos versiones de los instaladores ...en algo fallé, a partir de ahora solo subiré para x64, y así no cometo fallos.

Ya he corregido el problema y puedes descargar el instalador para 64 Bit del enlace del primer post.

De todas formas aquí dejo para ti y los demás un video demostrativo (Con temazo auditivo incluido ;)):



Saludos!
8196  Sistemas Operativos / Windows / [APORTE] Menu en cascada para Windows 8 - Explorer en: 16 Septiembre 2013, 16:20 pm
Menu en cascada para Windows 8 - Explorer



Imágenes:





Demostración:





Instrucciones:

1. Descargar el siguiente archivo:

-> Para Windows 8 64 Bit

2. Instalarlo.


Que lo disfruten!
8197  Informática / Software / Re: Filezilla en: 16 Septiembre 2013, 14:17 pm
Saben si Filezilla tiene historial de envios?
Quisiera saber lo que envie la ultima vez y no encuentro la manera.

Filezilla tiene un log, pero no está activado por defecto... así que si no tenias activada la opción siento decirte que no existe esa información en ninguna parte :P



Saludos
8198  Sistemas Operativos / Windows / Re: [APORTE] Menu en cascada para Windows 8 - Reiniciar equipo en: 16 Septiembre 2013, 13:31 pm
Sin darme cuenta subí una versión que no estaba acabada, no se como cometí tremendo despiste, después de reiniciar en modo seguro habia que iniciar de forma manual el proceso del explorer, os pido mil disculpas.

He subido una versión corregida (y además con mejoras), aquí podeis ver como funciona perféctamente:




Nadie me ha reportado ningún problema así que quizás llego a tiempo y todavía nadie se ha descargado el primer instalador que compartí.

Pero si alguien ha sufrido algún problema con su inicio del explorador de Windows entonces ejecuten este comando en la consola para solucionarlo:

Código:
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v "Shell" /T "REG_SZ" /D "Explorer.exe" /F

De todas formas aquí pongo un tutorial que he hecho para explicar la manera de corregir el problema de la versión que compartí:




PD: Ya lo pueden descargar y usar sin peligro en los enlaces del primer post,
un saludo!
8199  Programación / .NET (C#, VB.NET, ASP) / Re: Librería de Snippets !! (Posteen aquí sus snippets) en: 16 Septiembre 2013, 08:40 am
· Una nueva versión de mi FileInfo personalizado, para obtener información sobre un archivo.

Código
  1.    Public Class InfoFile
  2.  
  3. #Region " InfoFile "
  4.  
  5.        ' [ InfoFile ]
  6.        '
  7.        ' // By Elektro H@cker
  8.        '
  9.        ' Examples:
  10.        '
  11.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Name)) ' Result: Test
  12.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Extension_Without_Dot)) ' Result: txt
  13.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileName)) ' Result: Test.txt
  14.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Directory)) ' Result: C:\
  15.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.DriveRoot)) ' Result: C:\
  16.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.DriveLetter)) ' Result: C
  17.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FullName)) ' Result: C:\Test.txt
  18.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.ShortName)) ' Result: Test.txt
  19.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.ShortPath)) ' Result: C:\Test.txt
  20.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Name_Length)) ' Result: 8
  21.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Extension_Without_Dot_Length)) ' Result: 3
  22.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileName_Length)) ' Result: 8
  23.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Directory_Length)) ' Result: 3
  24.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FullName_Length)) ' Result: 11
  25.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileSize_Byte)) ' Result: 5.127.975
  26.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileSize_KB)) ' Result: 5.007.79
  27.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileSize_MB)) ' Result: 4,89
  28.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileSize_GB)) ' Result: 0,00
  29.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileSize_TB)) ' Result: 0,00
  30.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.FileVersion)) ' Result: ""
  31.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Attributes_Enum)) ' Result: 8224
  32.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Attributes_String)) ' Result: Archive, NotContentIndexed
  33.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.CreationTime)) ' Result: 16/09/2012  8:28:17
  34.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.LastAccessTime)) ' Result: 16/09/2012 10:51:17
  35.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.LastModifyTime)) ' Result: 16/09/2012 10:51:17
  36.        ' MsgBox(InfoFile.Get_Info("C:\Test.txt", InfoFile.Info.Has_Extension)) ' Result: True
  37.  
  38.        Public Enum Info
  39.  
  40.            Name                  ' Filename without extension
  41.            Extension_With_Dot    ' File-Extension (with dot included)
  42.            Extension_Without_Dot ' File-Extension (without dot)
  43.            FileName              ' Filename.extension
  44.            Directory             ' Directory name
  45.            FullName              ' Directory path + Filename
  46.  
  47.            DriveRoot             ' Drive letter
  48.            DriveLetter           ' Drive letter (only 1 character)
  49.  
  50.            ShortName ' DOS8.3 Filename
  51.            ShortPath ' DOS8.3 Path Name
  52.  
  53.            Name_Length                  ' Length of Filename without extension
  54.            Extension_With_Dot_Length    ' Length of File-Extension (with dot included)
  55.            Extension_Without_Dot_Length ' Length of File-Extension (without dot)
  56.            FileName_Length              ' Length of Filename.extension
  57.            Directory_Length             ' Length of Directory name
  58.            FullName_Length              ' Length of Directory path + Filename
  59.  
  60.            FileSize_Byte ' Size in Bytes
  61.            FileSize_KB   ' Size in KiloBytes
  62.            FileSize_MB   ' Size in MegaBytes
  63.            FileSize_GB   ' Size in GigaBytes
  64.            FileSize_TB   ' Size in TeraBytes
  65.  
  66.            FileVersion ' Version for DLL or EXE files
  67.  
  68.            Attributes_Enum   ' Attributes as numbers
  69.            Attributes_String ' Attributes as descriptions
  70.  
  71.            CreationTime   ' Date Creation time
  72.            LastAccessTime ' Date Last Access time
  73.            LastModifyTime ' Date Last Modify time
  74.  
  75.            Has_Extension  ' Checks if file have a file-extension.
  76.  
  77.        End Enum
  78.  
  79.        Public Shared Function Get_Info(ByVal File As String, ByVal Information As Info) As String
  80.  
  81.            Dim File_Info = My.Computer.FileSystem.GetFileInfo(File)
  82.  
  83.            Select Case Information
  84.  
  85.                Case Info.Name : Return File_Info.Name.Substring(0, File_Info.Name.LastIndexOf("."))
  86.                Case Info.Extension_With_Dot : Return File_Info.Extension
  87.                Case Info.Extension_Without_Dot : Return File_Info.Extension.Split(".").Last
  88.                Case Info.FileName : Return File_Info.Name
  89.                Case Info.Directory : Return File_Info.DirectoryName
  90.                Case Info.DriveRoot : Return File_Info.Directory.Root.ToString
  91.                Case Info.DriveLetter : Return File_Info.Directory.Root.ToString.Substring(0, 1)
  92.                Case Info.FullName : Return File_Info.FullName
  93.                Case Info.ShortName : Return CreateObject("Scripting.FileSystemObject").GetFile(File).ShortName
  94.                Case Info.ShortPath : Return CreateObject("Scripting.FileSystemObject").GetFile(File).ShortPath
  95.                Case Info.Name_Length : Return File_Info.Name.Length
  96.                Case Info.Extension_With_Dot_Length : Return File_Info.Extension.Length
  97.                Case Info.Extension_Without_Dot_Length : Return File_Info.Extension.Split(".").Last.Length
  98.                Case Info.FileName_Length : Return File_Info.Name.Length
  99.                Case Info.Directory_Length : Return File_Info.DirectoryName.Length
  100.                Case Info.FullName_Length : Return File_Info.FullName.Length
  101.                Case Info.FileSize_Byte : Return Convert.ToDouble(File_Info.Length).ToString("n0")
  102.                Case Info.FileSize_KB : Return (Convert.ToDouble(File_Info.Length) / 1024L).ToString("n2")
  103.                Case Info.FileSize_MB : Return (Convert.ToDouble(File_Info.Length) / 1024L ^ 2).ToString("n2")
  104.                Case Info.FileSize_GB : Return (Convert.ToDouble(File_Info.Length) / 1024L ^ 3).ToString("n2")
  105.                Case Info.FileSize_TB : Return (Convert.ToDouble(File_Info.Length) / 1024L ^ 4).ToString("n2")
  106.                Case Info.FileVersion : Return CreateObject("Scripting.FileSystemObject").GetFileVersion(File)
  107.                Case Info.Attributes_Enum : Return File_Info.Attributes
  108.                Case Info.Attributes_String : Return File_Info.Attributes.ToString
  109.                Case Info.CreationTime : Return File_Info.CreationTime
  110.                Case Info.LastAccessTime : Return File_Info.LastAccessTime
  111.                Case Info.LastModifyTime : Return File_Info.LastWriteTime
  112.                Case Info.Has_Extension : Return IO.Path.HasExtension(File)
  113.  
  114.                Case Else : Return String.Empty
  115.  
  116.            End Select
  117.  
  118.        End Function
  119.  
  120. #End Region
  121.  
  122.    End Class





· Lo mismo de arriba pero para directorios:

Código
  1. Public Class InfoDir
  2.  
  3. #Region " InfoDir "
  4.  
  5.    ' [ InfoDir ]
  6.    '
  7.    ' // By Elektro H@cker
  8.    '
  9.    ' Examples:
  10.    '
  11.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.Name)) ' Result: Test
  12.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.Parent)) ' Result: Test Parent
  13.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FullName)) ' Result: C:\Test Parent\Test
  14.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.DriveRoot)) ' Result: C:\
  15.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.DriveLetter)) ' Result: C
  16.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.Name_Length)) ' Result: 4
  17.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FullName_Length)) ' Result: 19
  18.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.Attributes_Enum)) ' Result: 8208
  19.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.Attributes_String)) ' Result: Directory, NotContentIndexed
  20.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.CreationTime)) ' Result: 16/09/2012  8:28:17
  21.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.LastAccessTime)) ' Result: 16/09/2012 10:51:17
  22.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.LastModifyTime)) ' Result: 16/09/2012 10:51:17
  23.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FileSize_Byte)) ' Result: 5.127.975
  24.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FileSize_KB)) ' Result: 5.007.79
  25.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FileSize_MB)) ' Result: 4,89
  26.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FileSize_GB)) ' Result: 0,00
  27.    ' MsgBox(InfoDir.Get_Info("C:\Test Parent\Test", InfoDir.Info.FileSize_TB)) ' Result: 0,00
  28.  
  29.    Public Enum Info
  30.  
  31.        Name                  ' Folder name
  32.        FullName              ' Directory path
  33.        Parent                ' Parent directory
  34.  
  35.        DriveRoot             ' Drive letter
  36.        DriveLetter           ' Drive letter (only 1 character)
  37.  
  38.        Name_Length                  ' Length of directory name
  39.        FullName_Length              ' Length of full directory path
  40.  
  41.        FileSize_Byte ' Size in Bytes     (including subfolders)
  42.        FileSize_KB   ' Size in KiloBytes (including subfolders)
  43.        FileSize_MB   ' Size in MegaBytes (including subfolders)
  44.        FileSize_GB   ' Size in GigaBytes (including subfolders)
  45.        FileSize_TB   ' Size in TeraBytes (including subfolders)
  46.  
  47.        Attributes_Enum   ' Attributes as numbers
  48.        Attributes_String ' Attributes as descriptions
  49.  
  50.        CreationTime   ' Date Creation time
  51.        LastAccessTime ' Date Last Access time
  52.        LastModifyTime ' Date Last Modify time
  53.  
  54.    End Enum
  55.  
  56.    Public Shared Function Get_Info(ByVal Dir As String, ByVal Information As Info) As String
  57.  
  58.        Dim Dir_Info = My.Computer.FileSystem.GetDirectoryInfo(Dir)
  59.  
  60.        Select Case Information
  61.  
  62.            Case Info.Name : Return Dir_Info.Name
  63.            Case Info.FullName : Return Dir_Info.FullName
  64.            Case Info.Parent : Return Dir_Info.Parent.ToString
  65.            Case Info.DriveRoot : Return Dir_Info.Root.ToString
  66.            Case Info.DriveLetter : Return Dir_Info.Root.ToString.Substring(0, 1)
  67.            Case Info.Name_Length : Return Dir_Info.Name.Length
  68.            Case Info.FullName_Length : Return Dir_Info.FullName.Length
  69.            Case Info.FileSize_Byte : Return Convert.ToDouble(Get_Directory_Size(Dir_Info)).ToString("n0")
  70.            Case Info.FileSize_KB : Return (Convert.ToDouble(Get_Directory_Size(Dir_Info)) / 1024L).ToString("n2")
  71.            Case Info.FileSize_MB : Return (Convert.ToDouble(Get_Directory_Size(Dir_Info)) / 1024L ^ 2).ToString("n2")
  72.            Case Info.FileSize_GB : Return (Convert.ToDouble(Get_Directory_Size(Dir_Info)) / 1024L ^ 3).ToString("n2")
  73.            Case Info.FileSize_TB : Return (Convert.ToDouble(Get_Directory_Size(Dir_Info)) / 1024L ^ 4).ToString("n2")
  74.            Case Info.Attributes_Enum : Return Dir_Info.Attributes
  75.            Case Info.Attributes_String : Return Dir_Info.Attributes.ToString
  76.            Case Info.CreationTime : Return Dir_Info.CreationTime
  77.            Case Info.LastAccessTime : Return Dir_Info.LastAccessTime
  78.            Case Info.LastModifyTime : Return Dir_Info.LastWriteTime
  79.  
  80.            Case Else : Return String.Empty
  81.  
  82.        End Select
  83.  
  84.    End Function
  85.  
  86.    Private Shared Function Get_Directory_Size(Directory As IO.DirectoryInfo) As Long
  87.        Try
  88.            Dim Dir_Total_Size As Long = Directory.EnumerateFiles().Sum(Function(file) file.Length)
  89.            Dir_Total_Size += Directory.EnumerateDirectories().Sum(Function(dir) Get_Directory_Size(dir))
  90.            Return Dir_Total_Size
  91.        Catch
  92.        End Try
  93.        Return -1
  94.    End Function
  95.  
  96. #End Region
  97.  
  98. End Class





Convierte bytes a otra unidad:

Código
  1. #Region " Convert Bytes Function "
  2.  
  3.    ' [ Convert Bytes Function ]
  4.    '
  5.    ' // By Elektro H@cker
  6.    '
  7.    ' Examples :
  8.    '
  9.    ' MsgBox(String.Format("{0} KB", Byte_To_Size(5127975, xByte.kilobyte, 2))) ' Result: 5007,79 KB
  10.    ' MsgBox(String.Format("{0} MB", Byte_To_Size(5127975, xByte.megabyte, 2))) ' Result: 4,89 MB
  11.    ' MsgBox(String.Format("{0} GB", Byte_To_Size(5127975, xByte.gigabyte, 3))) ' Result: 0,005 GB
  12.    ' MsgBox(String.Format("{0} TB", Byte_To_Size(5127975, xByte.terabyte, 3))) ' Result: 0 TB
  13.    ' MsgBox(String.Format("{0} PB", Byte_To_Size(5127975, xByte.petabyte, 3))) ' Result: 0 PB
  14.  
  15.    Enum xByte As Long
  16.        kilobyte = 1024L
  17.        megabyte = 1024L * kilobyte
  18.        gigabyte = 1024L * megabyte
  19.        terabyte = 1024L * gigabyte
  20.        petabyte = 1024L * terabyte
  21.    End Enum
  22.  
  23.    Private Function Byte_To_Size(ByVal bytes As Long, _
  24.                                  ByVal convertto As xByte, _
  25.                                  Optional ByVal decimals As Integer = 2 _
  26.                                  ) As Double
  27.  
  28.        Return (Convert.ToDouble(bytes) / convertto).ToString("n" & decimals)
  29.  
  30.    End Function
  31.  
  32. #End Region
  33.  
8200  Sistemas Operativos / Windows / Re: [APORTE] Menu en cascada para Windows 8 - Reiniciar equipo en: 16 Septiembre 2013, 06:16 am
gracias
Páginas: 1 ... 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 834 835 ... 1236
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines