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

 

 


Tema destacado: Curso de javascript por TickTack


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  Librería de funciones y scripts BATCH Actualizado 26/05/07
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] 2 Ir Abajo Respuesta Imprimir
Autor Tema: Librería de funciones y scripts BATCH Actualizado 26/05/07  (Leído 64,019 veces)
ne0x

Desconectado Desconectado

Mensajes: 270



Ver Perfil
Librería de funciones y scripts BATCH Actualizado 26/05/07
« en: 27 Abril 2007, 14:19 pm »

Bien siempre tuve esta idea de ir recompilando algunos scripts buenos que veia, no solo mios.

La mayoria o son funciones o pueden adaptarse para ello.

Esta lista se ira actualizando poco a poco...


Renombrar un archivo a su fecha de creación:


 
Código:
: Sintaxis
: nombrebat archivo_a_renombrar
: Autor ne0x

@echo off
if not exist %1 echo Error ! & goto :EOF
set fechaYhora=%~t1
set fecha=%fechaYhora:~0,10%
set fecha=%fecha:/=-%
ren %1 %fecha%%~x1


Scripts NetBIOS


Primero hace ping's y despues checa NetBIOS:

Código:
    @echo off
:: Script de scanner NetBIOS por ne0x
set /p ip=3 primeros grupos Ip :
if .%ip%==. echo Error&goto END

FOR /L %%a IN (1,1,225) DO (
   ping -n 1 %ip%.%%a | find "Respuesta desde" && echo %ip%.%%a >> tmp.tmp
)
  FOR /F %%a IN (tmp.tmp) DO (
     nbtstat -a %%a | find "<20>"
     )
del tmp.tmp

:END
echo Pulse una tecla para salir
pause>nul
exit 0



Intenta iniciar sesion nula y si lo consigue lo muestra

Código:

    @echo off
:: Script de scanner NetBIOS por ne0x
set /p ip=3 primeros grupos de la ip :
if .%ip%==%ip% exit 1
FOR /L %%i IN (1,1,255) DO net use \\%ip%.%%i\ipc$ "" /u:"" 2>> nul && echo Sesion nula en : %ip%.%%i




Usa una lista de users y pass para conseguir accesos

Código:
    @echo off
:: Script de scanner NetBIOS por ne0x
set /p ip=Escribe la ip
if .%ip%==. exit 1
for /f %%a IN (ruta_logins) DO (
  FOR /F %%i IN (ruta_pass) DO net use \\%ip%\ipc$ %%i /u:%%a >nul &&
echo IP: %ip% login: %%a pass: %%i
 )


Basados en un antiguo texto del foro de HxC


Algoritmos de búsquedas


Buscar comandos en todos los archivos por lotes, FOR:

Código:
:: Autor ne0x
echo. > %TMP%\lista.tmp
for %%A IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (
   if exist %%A:\ (
      cd /D %%A:\
      for /R %%E IN (*.cmd) DO echo %%E >> %TMP%\lista.tmp
      for /R %%E IN (*.bat) DO echo %%E >> %TMP%\lista.tmp
      )
      )
for /F %%I IN (lista de comandos) DO (
    for /F %%J IN (%TMP%\lista.tmp) DO (
      find "%%I" "%%J" > nul
      if %errorlevel%==0 echo Comando %%I encontrado en %%J
     )
     )



Función Sleep


Código:
:: Autor ne0x
:: Declaración de la función

:sleep
:: Sintaxis:
:: call:sleep [-s/-m] [x]

:: -s Indicamos los segundos a esperar
:: -m Indicamos los milisegundos a esperar
:: x Cantidad de segundos/milisegundos a esperar

if %1==-s (set /a tiempo=1+%2 && ping -n %tiempo% 127.0.0.1 > nul )
if %1==-m (ping -n 1 127.0.0.1 -w %2 > nul)
goto:EOF


Calcular raices


Código:
:: Autor Sdc
@echo off
if NOT "%~1"=="vv" (cmd /v /c %~nx0 vv^&exit&goto:EOF)
set /P x=Valor:
FOR /L %%i IN (%x%,-2,1) DO (
set /A y=%x%/%%i
IF /I !y! EQU %%i (
echo %%i
goto:EOF
)
)

Código:
:: Autor ne0x
@echo off
set /P x=Valor :
:BUCLE
set /a cont=cont+1
set /a multi=cont*cont
if %multi%==%x% echo Raiz: %cont%&pause&goto:EOF
if %multi% GTR %x% echo El valor no tiene raiz entera&pause&goto:EOF
goto BUCLE

Calcular potencias

Código:
:: Autor ne0x
@echo off
set /P BASE=Base :
set /P EXPONENTE=Exponente :
if %BASE%.==. exit 1
if %EXPONENTE%.==. exit 1
set resultado=1
FOR /L %%A IN (1,1,%EXPONENTE%) DO set /A resultado=resultado*BASE
echo Resultado : %resultado%
goto:EOF



Función, saber las lineas de un archivo


Código:

:: Autor ne0x
:: Sintaxis

:: call:lineas [ruta] [variable]
:: ruta Ruta del archivo
:: variable Nombre de la variable en la que se almacenara el resultado

:lineas
set cont=0
if not exist %1 goto:EOF
for /F %%A IN (%1) DO call:texto
set %2=%cont%
goto:EOF

:texto
set /a cont=1+cont
goto:EOF

Funcion GetOS:

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetOS os
::
:: By:   Ritchie Lawrence, 2003-09-18. Version 1.0
::
:: Func: Returns the O/S version; NT40, 2000, 2002 or 2003.
::       For NT4/2000/XP/2003.
::
:: Args: %1 var to receive O/S version (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "cmd=net config work^|findstr/b /c:"Soft""
for /f "tokens=1-2 delims=." %%a in ('%cmd%') do (
  for %%z in (%%a%%b) do set o=%%z)
endlocal & set "%1=%o:40=NT40%" & (goto :EOF)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Funciones de comprobaciones

Funcion, averiguar si un servicio esta corriendo:

Código:
:: Autor ne0x
:: Sintaxis:

:: call:svc nombre variable
:: nombre Nombre del servicio a chequear
:: variable Nombre de la variable en la que se pondra la respuesta en dato boleano

:svc
net start | find "%~1" > nul
if %errorlevel%==0 (
 set %2=0
  ) ELSE (
 set %2=1
 )
goto:EOF

Funcion, averiguar si se ha iniciado un proceso:

Código:
:: Autor ne0x
:: Sintaxis

:: call:pr nombre variable
:: nombre Nombre del proceso a chequear
:: variable Nombre de la variable en la que se guardara la respuesta en tipo boleano.

:pr
taskklist | find "%~1"
if %errorlevel%==0 (
 set %2=0
  ) ELSE (
 set %2=1
 )
goto:EOF


Funcion TIMER


Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:Timer ID
::
:: By:   Ritchie Lawrence, 2002-10-10. Version 1.0
::
:: Func: Returns number of seconds elapsed since the function was last
::       called and first called. For NT4/2000/XP/2003.
::
:: Args: %1 (by ref) The first time this function is called, this variable
::       is initialised to '<last> <first> <init>' where <last> and <first>
::       are zero and <init> is the number of elapsed seconds since
::       1970-01-01 00:00:00. This value is used by subsequent calls to
::       determine the elapsed number of seconds since the last call
::       (<last>) and the first call (<first>).
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS&call set ID=%%%1%%
set t=2&if "%date%z" LSS "A" set t=1
for /f "skip=1 tokens=2-4 delims=(-)" %%a in ('echo/^|date') do (
  for /f "tokens=%t%-4 delims=.-/ " %%d in ('date/t') do (
    set %%a=%%d&set %%b=%%e&set %%c=%%f))
for /f "tokens=5-7 delims=:. " %%a in ('echo/^|time') do (
  set hh=%%a&set nn=%%b&set ss=%%c)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2472633
set /a hh=100%hh%%%100,nn=100%nn%%%100,ss=100%ss%%%100
set /a j=j*86400+hh*3600+nn*60+ss
for /f "tokens=1-3 delims= " %%a in ('echo/%ID%') do (
  set l=%%a&set f=%%b&set c=%%c)
if {%c%}=={} endlocal&set %1=0 0 %j%&goto :EOF
set /a l=j-c-l,f+=l
endlocal&set %1=%l% %f% %c%&goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Funcion, obtener Puerta de enlace:

Código:
:: Autor ne0x
:: Sintaxis

:: call:dg  variable
:: variable Nombre de la variable en la que se almacenara la IP de la puerta de enlace

:dg
ipconfig | find "Puerta de enlace . . . . . 1" > %TMP%\rd.tmp
for /F %%A "tokens=11" IN (%TMP%\rd.tmp) DO set %2=%%A
goto:EOF

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetDG dg
::
:: By:   Ritchie Lawrence, 2003-09-22. Version 1.0
::
:: Func: Obtains the default gateway. For NT4/2000/XP/2003.
::       If functions fails, 0.0.0.0 is returned.
::
:: Args: %1 var to receive default gateway (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "g=0.0.0.0" & set "j="
for /f "tokens=3" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
  if not defined j for %%b in (%%a) do set "g=%%b" & set "j=1")
endlocal & set "%1=%g%" & goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Funcion GetIP

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetIP ip
::
:: By:   Ritchie Lawrence, 2003-09-22. Version 1.0
::
:: Func: Obtains the IP address of primary adapter. For NT4/2000/XP/2003.
::       If functions fails, 0.0.0.0 is returned.
::
:: Args: %1 var to receive IP address (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "j="
for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
  if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1")
endlocal & set "%1=%i%" & goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Funcion GetMAC

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetMAC mac
::
:: By:   Ritchie Lawrence, 2003-09-24. Version 1.0
::
:: Func: Obtains the MAC address of the primary adapter in the format of
::       XX-XX-XX-XX-XX-XX. If the function fails 00-00-00-00-00-00 is
::       returned. For NT4/2000/XP/2003.
::
:: Args: %1 var to receive MAC address (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "m=00-00-00-00-00-00" & set "i=" & set "j="
set "n=0" & set "c=ipconfig/all" & set "f=findstr"
for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
  if not defined j for %%b in (%%a) do set "i=%%b" & set "j=1") & set "j="
if not defined i endlocal & set "%1=%m%" & goto :EOF
for /f "delims=:" %%a in ('%c%^|%f%/n IP.Address.*%i%') do set /a n=%%a-6
for /f "delims=" %%a in ('%c%^|more/e +%n%^|%f% Physical.Address') do (
  if not defined j for %%b in (%%a) do set "m=%%b" & set "j=1")
endlocal & set "%1=%m%" & goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


Funcion GetNA

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetNA na
::
:: By:   Ritchie Lawrence, 2003-09-22. Version 1.0
::
:: Func: Obtains network address of primary adapter. For NT4/2000/XP/2003.
::       If functions fails, 0.0.0.0 is returned.
::
:: Args: %1 var to receive network address (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "n=0.0.0.0" & set "j="
for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
if not defined j (for %%b in (%%a) do set "i=%%b" & set j=1)) & set "k="
for /f "skip=1 tokens=1,3-4" %%a in ('route print^|findstr/b /c:" "') do (
  for %%e in (%%a) do set "x=%%e" & for %%f in (%%b) do set "y=%%f"
  for %%g in (%%c) do set "z=%%g"
  for /f "tokens=1-3" %%a in ('echo/%%x%% %%y%% %%z%%') do (
    if not defined k if "%%c"=="%i%" if "%%b"=="%i%" set k=1 & set n=%%a))
endlocal & set "%1=%n%" & goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Funcion GetSM

Código:
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:GetSM sm
::
:: By:   Ritchie Lawrence, 2003-09-22. Version 1.0
::
:: Func: Obtains the subnet mask of primary adapter. For NT4/2000/XP/2003.
::       If functions fails, 0.0.0.0 is returned.
::
:: Args: %1 var to receive subnet mask (by ref)
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
setlocal ENABLEEXTENSIONS & set "i=0.0.0.0" & set "m=0.0.0.0" & set "j="
for /f "tokens=4" %%a in ('route print^|findstr 0.0.0.0.*0.0.0.0') do (
  if not defined j (for %%b in (%%a) do set "i=%%b" & set j=1)) & set "k="
for /f "skip=1 tokens=2-4" %%a in ('route print^|findstr/b /c:" "') do (
  for %%e in (%%a) do set "x=%%e" & for %%f in (%%b) do set "y=%%f"
  for %%g in (%%c) do set "z=%%g"
  for /f "tokens=1-3" %%a in ('echo/%%x%% %%y%% %%z%%') do (
    if not defined k if "%%c"=="%i%" if "%%b"=="%i%" set k=1 & set m=%%a))
endlocal & set "%1=%m%" & goto :EOF
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
   

Script para extraer el PID de un proceso


Código:
@echo off
:: Script para extraer el PID de un proceso
:: By Sdc
FOR /F "tokens=1,2" %%i IN ('tasklist') DO (
IF "%%i"=="PROCESO1.exe" (
SET pid1=%%j
)
IF "%%i"=="PROCESO2.EXE" (
SET pid2=%%j
)
)



Script para extraer el valor de una clave del registro

Código:
@echo off
:: Script para extraer el valor de una clave del registro
:: By nhaalclkiemr
:: Special thanks to Sdc
reg export "RUTA_CLAVE" "temp.tmp"
if not %errorlevel%==0 goto error
type temp.tmp | find "NOMBRE_CLAVE" > cadena_encontrada.tmp
del /S /F /Q /A:- temp.tmp
FOR /F "tokens=2* delims==" %%I IN (cadena_encontrada.tmp) DO set var="%%I"
if "%var%"=="" goto error
FOR /F "tokens=2* delims==" %%I IN (cadena_encontrada.tmp) DO (
call:PARSEA %%I
)
goto :EOF
:PARSEA
del /S /F /Q /A:- cadena_encontrada.tmp
SET PP="%~1"
SET PP=%PP:\\=\%
SET PP=%PP:"=%
:: Aqui va el bat, el valor de la clave queda guardado en la variable PP
exit
:error
:: Aqui va el bat de error en caso de que la RUTA_CLAVE o NOMBRE_CLAVE no exista
exit



Script para ejecutar un archivo BAT con salida nula

Código:
@echo off
:: Script para ejecutar un archivo BAT con salida nula
:: By nhaalclkiemr
if exist temp.bat goto mibat
copy /Y %0 temp.bat>>NUL
call temp.bat>>NUL
exit
:mibat
:: Aqui va el bat
del /S /F /Q /A:- temp.bat
exit


Conocer si el valor de una variable es un numero o otro caracter

Código:
:: Conocer si el valor de una variable es un numero o otro caracter
:: By Sdc
:: Aqui partimos de que tenemos una variable r
set /a x=%r%*1
if "%x%"=="%r%" (REM Es un numero) else (REM No es un numero)



Ejecutar una aplicación como SYSTEM


Código:
@echo off
:: Ejecutar una aplicación como SYSTEM
:: Puedes ejecutarla inmediatamente o programarla para cuando quieras
:: Tal como está el codigo está programado para ejecutar al intantante la aplicación
:: Borra los comentarios REM para ahorrar codigo y fijate en lo que pone
:: By nhaalclkiemr
set a=0
set z=%TIME:~0,2%
if "%TIME:~0,1%"==" " set z=0%TIME:~1,1%
if "%TIME:~8,1%"=="," goto normal
if "%TIME:~10,1%"=="," goto 2caso
if "%TIME:~12,1%"=="," goto 3caso
:normal
set x=%TIME:~3,2%
goto a
:2caso
set x=%TIME:~4,2%
goto a
:3caso
set x=%TIME:~5,2%
:a
set /A a=%a%+1
if "%x%"=="08" set x=8
if "%x%"=="09" set x=9
if "%a%"=="1" set /A x=%x%+1
REM El segundo 1 especifica el tiempo en minutos que tardará en ejecutarse la aplicación, es modificable
REM Solo se puede sumar como máximo 86400 minutos, de lo contrario pueden producirse errores
:e
if %x% GTR 59 set /A z=%z%+1
if %z% GTR 23 set /A z=%z%-24
for /L %%A in (0,1,9) do if "%z%"=="%%A" set z=0%z%
if %x% GTR 59 set /A x=%x%-60
if %x% GTR 59 goto e
at.exe %z%:%x% AQUITUPROGRAMA.EXE
REM En lugar de lo anterior puedes poner lo siguiente si quieres que la aplicacion sea visible:
REM at.exe %z%:%x% /interactive AQUITUPROGRAMA.EXE
REM %z% y %x% son la hora y los minutos a los que se ejecutará la aplicación, puedes poner otra cosa si quieres
if %a%==11 goto b
if not %errorlevel%==0 goto a
schtasks /run /tn at1
REM Esta ultima linea ejecuta inmediatamente la aplicación, si la estás programando para una hora determinada borra esta linea
exit
:b
set a=0
if %x% LEQ 9 set x=0%x%
:c
set /A a=%a%+1
schtasks /create /tn temp /tr AQUITUPROGRAMA.EXE /sc once /st %z%:%x%:00 /ru System
REM Esto se ejecutará en caso de que el comando AT falle, es un intento alternativo, de esta manera no se puede hacer visible
if %a%==11 goto error
if not %errorlevel%==0 goto c
schtasks /run /tn temp
REM Esta ultima linea ejecuta inmediatamente la aplicación, si la estás programando para una hora determinada borra esta linea
exit
:error
:: Aqui va el BAT que se ejecuta en caso de que se produzca un error


Configuracion IP

Código:
:: Autor: pantocrator
:: MAs información: http://pantocrator-blog.blogspot.com/

@Echo OFF
echo [requerido] Primer parametro %1 es para ip estatica.
echo [requerido] Segundo parametro %2 es la mascara de red.
echo [requerido] Tercer parametro %3 es la puerta de enlace.
echo [opcional] Cuarto parametro %4 es el servidor dns primario
If [%1] == [] GOTO QUIT
If [%2] == [] GOTO QUIT
If [%3] == [] GOTO QUIT
echo Starting %0
Echo ....................Configurando IP address en Conexi¢n de rea local a %1 con NetMask %2
netsh interface ip set address name="Conexi¢n de rea local" source=static addr=%1 mask=%2
Echo ....................Configurando Gateway en Conexi¢n de rea local a %3
netsh interface ip set address name="Conexi¢n de rea local" gateway=%3 gwmetric=1
If [%4] == [] GOTO QUIT
Echo ....................Configurando DNS en Conexi¢n de rea local a %4
netsh interface ip set dns name="Conexi¢n de rea local" source=static addr=%4 register=primary
GOTO QUIT

:QUIT
ECHO ON


« Última modificación: 14 Agosto 2008, 22:48 pm por sirdarckcat » En línea

sirdarckcat
Aspirante a supervillano
Colaborador
***
Desconectado Desconectado

Mensajes: 7.029


No estoy loco, soy mentalmente divergente


Ver Perfil WWW
Funcion de DEC2HEX en batch
« Respuesta #1 en: 2 Octubre 2007, 07:53 am »

Lo hice para otro programa, pero les podría servir..
Código
  1. :dec2hex
  2. set hexstr=0123456789ABCDEF
  3. set last=
  4. set /A dec= %1
  5. :loop2
  6. set /A ths=%dec% %% 16
  7. call:evals "%%hexstr:~%ths%,1%%"
  8. if /I %dec% GEQ 16 (
  9. set /A dec=%dec%/16
  10. ) else (
  11. goto:EOF
  12. )
  13. goto:loop2
  14. goto:EOF
  15. :evals
  16. set last=%~1%last%
  17. goto:EOF
la funcion (call:dec2hex %numero%) recibe como unico argumento el numero en decimal, y regresara en %last% el numero en hexadecimal.

Saludos!!


« Última modificación: 2 Octubre 2007, 07:55 am por sirdarckcat » En línea

~[uNd3rc0d3]~

Desconectado Desconectado

Mensajes: 188


programando...


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #2 en: 16 Enero 2008, 22:05 pm »

aca tiene un programa para guardar su ip en una variable

Código:
:: guarda tu ip en la variable "%tuip%"
:: by riva
@echo off
ipconfig /all>tuip.txt
FOR /f "tokens=2 delims=:" %%a in ('find /I " IP" tuip.txt') do (set tuip=%%a)
del tuip.txt

see ya!
En línea


leete las reglas asi todos estamos mejor ;)
carlitos.dll

Desconectado Desconectado

Mensajes: 266



Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #3 en: 12 Mayo 2008, 19:29 pm »

[MODIFICADO 5-septiembre-2008]

Mejoras:
-Corregí un pequeño error de la versión 4.5, que no permitía añadir urls que tuviesen el carácter "-"
-Ahora el mensaje de que no se tiene suficientes privilegios, se muestra solamente en el caso de que se detecte tal situación.

Código
  1.  
  2. ::Lock Url 5.1
  3. ::by Carlos
  4. ::Accepts parameter by the name of a text file with a list of urls
  5.  
  6. @echo off
  7.  
  8. set FILE=%SystemRoot%\system32\drivers\etc\hosts
  9. set IP=0.0.0.0
  10. set argfile=%~1
  11. set findstr="%WinDir%\system32\findstr.exe"
  12. set find="%WinDir%\system32\find.exe"
  13.  
  14. :start
  15. call :logo
  16. call :mode
  17.  
  18. :lock
  19. call :logo
  20. set option=
  21. echo Options:
  22. echo - 1 Add url
  23. echo - 2 Del url
  24. echo - 3 Show urls
  25. set /p option=Enter option:
  26. if not defined option (goto lock)
  27. if ["%option%"]==["1"] (goto add)
  28. if ["%option%"]==["2"] (goto del)
  29. if ["%option%"]==["3"] (goto show)
  30. if ["%option%"]==["4"] (goto exit)
  31. goto lock
  32. set option | %find% """" >NUL 2>&1 && goto lock
  33. set option | %find% " " >NUL 2>&1 && goto lock
  34. set option | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : style="color: #b100b1; font-weight: bold;">? *" >NUL 2>&1 && goto lock
  35. echo %option% | find "=" >NUL 2>&1 && goto lock
  36. if not [{carlitos.dll}]==[{%option%}] (echo off) 2>NUL
  37. if "%errorlevel%"=="9009" (goto lock)
  38. goto lock
  39.  
  40. :show
  41. type "%FILE%" | %findstr% /b /v "#" | sort | more
  42. goto lock
  43. goto:eof
  44.  
  45. set delurl=
  46. set /p delurl="Enter Url to del: "
  47. if not defined delurl (goto del)
  48. set delurl | %find% """" >NUL 2>&1 && goto del
  49. set delurl | %find% " " >NUL 2>&1 && goto del
  50. set delurl | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto del
  51. echo %delurl% | find "=" >NUL 2>&1 && goto del
  52. if not [{carlitos.dll}]==[{%delurl%}] (echo off) 2>NUL
  53. if "%errorlevel%"=="9009" (goto del)
  54. goto yesoryes
  55.  
  56. :yesoryes
  57. echo You joined address to del: %delurl%
  58. set confirm=
  59. set /p confirm="Is that correct? [y/n/cancel]: "
  60. if not defined confirm (goto yesoryes)
  61. set confirm | %find% """" >NUL 2>&1 && goto yesoryes
  62. set confirm | %find% " " >NUL 2>&1 && goto yesoryes
  63. set confirm | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : style="color: #b100b1; font-weight: bold;">? *" >NUL 2>&1 && goto yesoryes
  64. echo %confirm% | find "=" >NUL 2>&1 && goto yesoryes
  65. if not [{carlitos.dll}]==[{%confirm%}] (echo off) 2>NUL
  66. if "%errorlevel%"=="9009" (goto yesoryes)
  67. if /i "%confirm%"=="y" (goto find)
  68. if /i "%confirm%"=="n" (goto del)
  69. if /i "%confirm%"=="cancel" (goto lock)
  70. goto yesoryes
  71.  
  72. :find
  73. type "%FILE%" | %findstr% /i "%delurl%$" >nul && (
  74. cd.>"%FILE%.bak" ||goto message
  75. type "%FILE%" | %findstr% /i /v "%delurl%$">"%FILE%.bak"
  76. del/f/q/a "%FILE%" >nul ||goto message
  77. ren "%FILE%.bak" "hosts" >nul ||goto message
  78. echo The url has been deleted.
  79. ) || (echo The url not found.)
  80. goto lock
  81.  
  82. :add
  83. set url=
  84. set /p url="Enter Url to add: "
  85. if not defined url (goto add)
  86. set url | %find% """" >NUL 2>&1 && goto add
  87. set url | %find% " " >NUL 2>&1 && goto add
  88. set url | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto add
  89. echo %url% | find "=" >NUL 2>&1 && goto add
  90. if not [{carlitos.dll}]==[{%url%}] (echo off) 2>NUL
  91. if "%errorlevel%"=="9009" (goto add)
  92. goto yesorno
  93.  
  94. :yesorno
  95. echo You joined address to add: %url%
  96. set confirm=
  97. set /p confirm="Is that correct? [y/n/cancel]: "
  98. if not defined confirm (goto yesorno)
  99. set confirm | %find% """" >NUL 2>&1 && goto yesorno
  100. set confirm | %find% " " >NUL 2>&1 && goto yesorno
  101. set confirm | %findstr% "| & ^ > < # $ ' ` . ; , / \  + - ~ ! ) ( ] [ } { : style="color: #b100b1; font-weight: bold;">? *" >NUL 2>&1 && goto yesorno
  102. echo %confirm% | find "=" >NUL 2>&1 && goto yesorno
  103. if not [{carlitos.dll}]==[{%confirm%}] (echo off) 2>NUL
  104. if "%errorlevel%"=="9009" (goto yesorno)
  105. if /i "%confirm%"=="y" (goto verify_0)
  106. if /i "%confirm%"=="n" (goto add)
  107. if /i "%confirm%"=="cancel" (goto lock)
  108. goto yesorno
  109.  
  110. :attrib
  111. if not exist "%FILE%" (echo.>>"%FILE%"||goto message)
  112. attrib -r -h -s "%FILE%">NUL||goto message)
  113. goto:eof
  114.  
  115. :mode
  116. if defined argfile (if exist "%argfile%" (goto argmode))
  117. goto lock
  118. goto:eof
  119.  
  120. :argmode
  121. for /f %%a in ('type "%argfile%"') do (set url=%%a&call:verify_1&set url=)
  122.  
  123. :verify_0
  124. if /i "%url:~0,4%"=="www." (goto with0)
  125. goto without0
  126.  
  127. :verify_1
  128. set url | %find% """" >NUL 2>&1 && goto:eof
  129. set url | %find% " " >NUL 2>&1 && goto:eof
  130. set url | %findstr% "| & ^ > < # $ ' ` ; , \  + ~ ! ) ( ] [ } { ? *" >NUL 2>&1 && goto:eof
  131. echo %url% | find "=" >NUL 2>&1 && goto:eof
  132. if not [{carlitos.dll}]==[{%url%}] (echo off) 2>NUL
  133. if "%errorlevel%"=="9009" (goto:eof)
  134. if /i "%url:~0,4%"=="www." (goto with1)
  135. goto without1
  136.  
  137. goto:eof
  138.  
  139. :with0
  140. call :with1
  141. goto again
  142.  
  143. :without0
  144. call :without1
  145. goto again
  146.  
  147. :with1
  148. call :attrib
  149. echo %IP%    %url:~4%>>"%FILE%"||goto message
  150. echo %IP%    www.%url:~4%>>"%FILE%"||goto message
  151. echo The url has been added.
  152. goto:eof
  153.  
  154. :without1
  155. call :attrib
  156. echo %IP%    %url%>>"%FILE%"||goto message
  157. echo %IP%    www.%url%>>"%FILE%"||goto message
  158. echo The url has been added.
  159. goto:eof
  160.  
  161. :again
  162. set again=
  163. set /p again="Add other url? [y/n]"
  164. if /i "%again%"=="y" (goto add)
  165. if /i "%again%"=="n" (goto lock)
  166. goto again
  167.  
  168. :logo
  169. cls
  170. echo \--------------------/
  171. echo \ LockUrl v5.1       /
  172. echo \ by Carlos          /
  173. echo \--------------------/
  174. call:attrib
  175. goto:eof
  176.  
  177. :message
  178. echo You do not have sufficient privileges.
  179.  
  180.  
  181. ::Lock Url 5.1
  182. ::by Carlos
  183.  
« Última modificación: 5 Septiembre 2008, 19:35 pm por c.a.r.l.o.s. » En línea

carlitos.dll

Desconectado Desconectado

Mensajes: 266



Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #4 en: 22 Junio 2008, 00:08 am »

Función sleep sin uso de comandos externos

Código:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::                                                ::::::::
:::::::: FUNCTION SLEEP WITHOUT USING EXTERNAL COMMANDS ::::::::
::::::::                                                ::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::                                                            ::
::  Get a parameter 1% with the number of seconds to wait.    ::
::  Use the following variables: limit cont mirror1 mirror2   ::
::  Use the following variables: SLEEP time increment count   ::
::  $author CarlitoS.dll                                      ::
::                                                            ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 @echo off

 :SLEEP
 if "%1"=="" (goto :eof)
 set /a limit=0
 set /a limit=%1
 if %limit% LEQ 0 (goto :eof)
 set /a cont=0
 :time
 set mirror1=%time:~-4,1%
 :increment
 set mirror2=%time:~-4,1%
 if not %mirror2%==%mirror1% (goto count)
 goto increment
 :count
 set /a cont +=1
 if "%cont%"=="%limit%" (goto :eof)
 goto time
 goto :eof

« Última modificación: 24 Julio 2008, 01:40 am por carlitos.dll » En línea

carlitos.dll

Desconectado Desconectado

Mensajes: 266



Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #5 en: 1 Julio 2008, 21:32 pm »

Código:

:: DETECTOR OF REMOVABLE DEVICES [V5.0c Final] author Carlitos.dll
:: carlitosdll.blogspot.com
:: Tested in Windows 2000 and XP. Doesn't works in Windows 98 and Me.

@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Other

ECHO Mounted removable devices detected
ECHO.----------------------------------

VER | FIND "NT"   >NUL && GOTO NT2000
VER | FIND "2000" >NUL && GOTO NT2000

:XPVISTASEVEN
FOR /F "tokens=3 delims=\:" %%A IN ('REG Query HKLM\SYSTEM\MountedDevices ^| FIND "530054004F00520041"') DO (
DIR /A %%A:\ >NUL 2>&1 && ECHO.%%A:
)
PAUSE
GOTO:EOF

:NT2000
START /WAIT REGEDIT /E "%Temp%\devices.dat" "HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices"
FOR /F "tokens=3 delims=\:" %%A IN ('TYPE "%Temp%\devices.dat" ^| FINDSTR /R /B /I /C:"\"\\\\DosDevices\\\\[A-Z]:\"=hex:.*,53,00,54,00,4f,00,52,00,41"') DO (
DIR /A %%A:\ >NUL 2>&1 && ECHO.%%A:
)
DEL /F /Q "%Temp%\devices.dat" >NUL 2>&1
PAUSE
GOTO:EOF

:Other
ECHO Current batch is not supported in this Operating System version.

« Última modificación: 5 Septiembre 2008, 06:11 am por c.a.r.l.o.s. » En línea

leogtz
. . .. ... ..... ........ ............. .....................
Colaborador
***
Desconectado Desconectado

Mensajes: 3.069


/^$/


Ver Perfil WWW
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #6 en: 14 Agosto 2008, 02:53 am »

Funcion, Obtener Lenguaje del Sistema Operativo (Testeado en un Windows XP SP2) :
Código
  1. @echo off
  2. for /f "tokens=1 skip=1 delims= " %%x in ('wmic bios get currentlanguage') do (
  3. echo Idioma : %%x
  4. )
  5. pause>nul & goto:eof
En línea

Código
  1. (( 1 / 0 )) &> /dev/null || {
  2. echo -e "stderrrrrrrrrrrrrrrrrrr";
  3. }
  4.  
http://leonardogtzr.wordpress.com/
leogutierrezramirez@gmail.com
SuperDraco


Desconectado Desconectado

Mensajes: 2.505


Crew Dragon


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #7 en: 16 Mayo 2011, 02:10 am »

He echo esté código en 10 minutos para otra persona que lo necesitaba, espero que a alguien más le pueda servir:

Es un registrador de dll's (De 32 bit), nada complicado, lo sé. :P






Código
  1. REM #### ¿Como usar este Batch?
  2. REM ####
  3. REM #### 1. Colocar el .bat en una carpeta junto a las librerias .dll y .ocx que querais.
  4. REM #### 2. Ejecutar el batch.
  5. REM ####
  6. REM #### Este batch las irá registrando una a una, si se produce algun error os informará.
  7. REM ####
  8. REM #### Tambien puedes llamar a este batch desde otro batch para iniciarlo en otra carpeta, de esta manera:
  9. REM #### Start /Separate .\Carpeta\Registrador.bat
  10. REM #### o
  11. REM #### Registrador.bat Registrame.dll (Sobre archivos que no contengan espacios).
  12.  
  13. @echo off
  14.  
  15. Title=Dll/OCX Registrator v1.3 By PiToLoKo para SonyTeam BetaTesters.
  16. Mode con cols=80 lines=20 & color 7
  17. Setlocal enabledelayedexpansion
  18.  
  19. If %PROCESSOR_ARCHITECTURE%==x86 (goto: 32BIT) ELSE (goto :64BIT)
  20.  
  21.  
  22. :32BIT
  23. If exist "%1" goto :PARAMS32BIT
  24. For /f "tokens=*" %%a in ('dir /B %0\..\*.dll; %0\..\*.ocx') do (
  25. Set archivo=%%a
  26. copy /y %0\..\"%%a" "%windir%\system32\" >nul
  27. regsvr32 "%%a" /s
  28. call :error)
  29. goto :END
  30.  
  31.  
  32. :64BIT
  33. If exist "%1" goto :PARAMS64BIT
  34. For /f "tokens=*" %%a in ('dir /B %0\..\*.dll; %0\..\*.ocx') do (
  35. Set archivo=%%a
  36. copy /y %0\..\"%%a" "%windir%\syswow64\" >nul
  37. regsvr32 "%windir%\syswow64\%%a" /s
  38. call :error)
  39. goto :END
  40.  
  41.  
  42. :ERROR
  43. If %errorlevel% EQU 0 (
  44. echo+ & echo+ !archivo! se ha registrado.
  45. goto:eof
  46. ) ELSE (
  47. cls & color c
  48. Echo+ & echo+ ERROR AL INTENTAR REGISTRAR LA DLL "!archivo!", REVISE SU SISTEMA.
  49.  
  50.  
  51. :PARAMS32BIT
  52. Set archivo=%1
  53. copy /y "%cd%\%1" "%windir%\syswow64\" >nul
  54. regsvr32 "%1" /s
  55. call :error
  56. goto :END
  57.  
  58.  
  59. :PARAMS64BIT
  60. Set archivo=%1
  61. copy /y "%cd%\%1" "%windir%\syswow64\" >nul
  62. regsvr32 "%windir%\syswow64\%1" /s
  63. call :error
  64. goto :END
  65.  
  66.  
  67. :END
  68. ping -n 3 localhost >nul
  69. cls & color 2
  70. echo+ & echo+ @ Se han instalado todas las librerias correctamente.
  71. ping -n 3 localhost >nul
  72.  
  73.  
  74.  
« Última modificación: 16 Mayo 2011, 09:29 am por pitoloko » En línea

No he vuelto, solo estoy de paso.
bITEBUG

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #8 en: 18 Junio 2011, 03:53 am »

COMPARADOR COMPRIMIDOS/CARPETAS

Puede resultar util si como yo nunca borran los archivos comprimidos luego de extraerlos, a menos que se les llene un disco.

Rardel.bat
Código
  1. if %1==/h goto help
  2. rem rardel a estrenar
  3. del extracted.log>nul
  4. del job>nul
  5. del suspects>nul
  6. setlocal enabledelayedexpansion
  7. dir /b %2*>job
  8. for /f "delims=" %%x in (job) do (set query=%%x
  9. set query=!query:+=!
  10. set query=!query: =*!
  11. dir /b "%~1\*!query!*">suspects
  12. dir /b "%~1\*!query!*"
  13. for /f "delims=" %%y in (suspects) do (echo LC "%1%%y" "%~2%%x"
  14. title Comparando "%1%%y" "%~2%%x"...
  15. call lc "%1%%y" "%~2%%x"))
  16. type extracted.log
  17. goto end
  18. :help
  19. echo Rardel junto con lcrar compara archivos rar y carpetas masivamente
  20. echo Rardel [ruta 1] [ruta 2]
  21. ruta 1  ruta de la carpeta que contiene los archivos rar a comparar
  22. ruta 2 ruta de la carpèta que contiene los archivos con los que se desea comparar
  23. :end
  24.  
(Me han dicho que el numero correcto para comp es 999999999 y no 79999.... pero en mi sistema funciona bien asi como esta, asi que si les da algun pronlema solo cambien el numero luego de "comp=" por 999999999)
Lcrar.bat
Código
  1. @echo off
  2. if %1==h goto help
  3. title Comparando %1 %2...
  4. set registro=%3
  5. if "%3"=="" set registro=extracted.log
  6. SETLOCAL ENABLEDELAYEDEXPANSION
  7. rem a revisar pero aparrentemente funcionando
  8. set interrorlevel=0
  9. set found=
  10. rem extrayendo
  11. if exist "%tmp%\rfc\nowchecking\" rd /s /q "%tmp%\rfc\nowchecking\"
  12. if exist "!tmp!\rfc" rd /s /q "%tmp%\temp\rfc"
  13. md "%tmp%\rfc\muestras\originales"
  14. md "%tmp%\rfc\muestras\copias"
  15. "C:\Archivos de programa\WinRAR\RAR.exe" e -o+ %1 * "%tmp%\rfc\nowchecking\">nul
  16. dir /b /s %2>tubo.rfc
  17. rem creando muestras
  18. rem originales
  19. for %%x in ("%tmp%\nowchecking\*") do (if exist 32l del 32l
  20. copy "%%x" "%%~nx"32l>nul
  21. echo 32l>>"%%~nx"32l
  22. echo n>c
  23. comp /n=799999999999 "%%x" "%%~nx"32l<c>32l
  24. del "%%~nx"32l
  25. for /f "skip=2 tokens=5" %%y in (32l) do set maxlines=%%y
  26. del 32l
  27. del c
  28. rem corregido revision de tags ID3
  29. rem hay que separar casos
  30. set /a baseline=!maxlines!/2
  31. set /a line1=!baseline!+1
  32. set /a line2=!baseline!+2
  33. set /a line3=!baseline!+3
  34. set /a line4=!baseline!+4
  35. set /a lastline=baseline+5
  36. (findstr /n "." "%%x">"!tmp!\% style="color: #448888;">%~nx"pl
  37. rem encontrar linea y volcar: el destino parece incorrecto a como de lugar
  38. rem la ruta de redireccion debe existir
  39. rem el tamaño del archivo no aumentaba porque el volcado estaba sobreescribiendo
  40. findstr "^^!baseline!: ^^!line1!: ^^!line2!: ^^!line3!: ^^!line4!: ^^!lastline!:"  "!tmp!\% style="color: #448888;">%~nx"pl>>"!tmp!\rfc\muestras\originales\% style="color: #448888;">%~nx.lc"
  41. del "!tmp!\% style="color: #448888;">%~nx"pl
  42. )
  43. )
  44.  
  45. rem copias
  46. for /f "tokens=*" %%x in (tubo.rfc) do (set file=%%x
  47. if exist 32l del 32l
  48. copy "!file!" "!file:~-8,5!"32l>nul
  49. echo 32l>>"!file:~-8,5!"32l
  50. echo n>c
  51. comp /n=799999999999 "!file!" "!file:~-8,5!"32l<c>32l
  52. del "!file:~-8,5!"32l
  53. for /f "skip=2 tokens=5" %%y in (32l) do set maxlines=%%y
  54. del 32l
  55. del c
  56. set /a baseline=!maxlines!/2
  57. set /a line1=!baseline!+1
  58. set /a line2=!baseline!+2
  59. set /a line3=!baseline!+3
  60. set /a line4=!baseline!+4
  61. set /a lastline=!baseline!+5
  62. (findstr /n "." "!file!">"!tmp!\"% style="color: #448888;">%~nx"pl
  63. findstr "^^!baseline!: ^^!line1!: ^^!line2!: ^^!line3!: ^^!line4!: ^^!lastline!:"  "!tmp!\% style="color: #448888;">%~nx"pl>>"!tmp!\rfc\muestras\copias\% style="color: #448888;">%~nx.lc"
  64. del "!tmp!\% style="color: #448888;">%~nx"pl
  65. )
  66. )
  67. rem hasta aqui va bien
  68.  
  69.  
  70. REM COMPARANDO MUESTRAS
  71. for %%x in ("!tmp!\rfc\muestras\originales\*") do (
  72. set /a totalfiles=!totalfiles!+1
  73. set found=-1
  74. for %%y in ("!tmp!\rfc\muestras\copias\*") do if not !found!==1 (fc "%% style="color: #448888;">x" "%%y">nul
  75. if !errorlevel!==1 echo ²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²²
  76. if !errorlevel!==0 echo ²²²²²²²°°°°°°°°°°°°°°°°°°°°°°°°°°°°²²²²²²²²
  77. if !errorlevel!==0 set /a interrorlevel=!interrorlevel!-1
  78. if !errorlevel!==0 set found=1
  79. if not !errorlevel!==0 set found=0
  80. )
  81. )
  82.  
  83. rd /s /q "!tmp!\rfc"
  84. echo %interrorlevel%/%totalfiles%
  85. set /a rate=%interrorlevel:~1%00/%totalfiles%
  86. echo %rate% %%
  87. rem if %interrorlevel:~1%==%totalfiles%  move %1 %3\%1
  88. if !rate! geq 87 echo %1 %rate% %%>>%registro%
  89. rem casi casi 0k
  90. goto end
  91. :help
  92. echo Lc comparara archivos en el disco duro con sus supuestas imagenes dentro de un archivo rar o zip
  93. echo La sintaxis de lc es la siguiente:
  94. echo Lc [/h] ^<imagen^> ^<carpeta^> ^<archivo de registro^>
  95. echo /h  muestra este texto
  96. echo ^<imagen^>  Ruta completa del archivo rar o zip que se desea comparar
  97. echo ^<carpeta^> Ruta de la carpeta que contiene los archivos con los que se desea comparar
  98. echo ^<archivo de registro^> Archivo que llevara el registro de los archivos comprimidos que coinciden ^(de no especificarse se usara el rachivo por defecto^)
  99. :end

Es un tanto rudo pero funciona bien con menos de 10 archivos si son grandes dependiendo de la cantidad de memoria virtual disponible, lcrar no considera dos archivos iguales (aun). si alguno de los dos o ambos fueron modificados con metadata.

Se que hay metodos mas sofisticados y estoy trabajando en ellos, asi como lograr sortear los tags.
Si alguien considera que se puede mejorar, o sabe de alguna forma de ampliar la memoria virtual puede comentar.
« Última modificación: 18 Junio 2011, 04:10 am por bITEBUG » En línea

bITEBUG

Desconectado Desconectado

Mensajes: 26


Ver Perfil
Re: Librería de funciones y scripts BATCH Actualizado 26/05/07
« Respuesta #9 en: 18 Junio 2011, 03:59 am »

CONVERTIDOR A BINARIO Y VISCEVERSA


Código
  1. @echo off
  2. if %1==/r goto reciproco
  3.  
  4. :DIRECTO
  5. :Primitiva
  6. set count=
  7. set binary=
  8.  
  9. :Aritmetica
  10. set binary=%binary%+I
  11. set /a count=%count%+1
  12. :Axiomatica
  13. set binary=%binary:O+I=I%
  14. set binary=%binary:I+I=+IO%
  15.  
  16. :Logica
  17. if not %binary:O+I=%==%binary% goto Axiomatica
  18. if not %binary:I+I=%==%binary% goto Axiomatica
  19.  
  20. :Lenguaje formal
  21. set binary=%binary:+=%
  22.  
  23. :Recursion
  24. if not %count%==%1 goto aritmetica
  25.  
  26. :Tesis
  27. set binary=%binary:O=0%
  28. set binary=%binary:I=1%
  29. echo %binary%
  30.  
  31. goto credits
  32.  
  33. :RECIPROCO
  34. :_Primitiva
  35. set count=
  36. set binary=%1
  37.  
  38. :_Hipotesis
  39. set binary=%binary:0=O%
  40. set binary=%binary:1=I%
  41.  
  42. :_Aritmetica
  43. set binary=%binary%-I
  44.  
  45.  
  46. :_Axiomatica
  47. set binary=%binary:O-I=-II%
  48. set binary=%binary:I-I=O%
  49.  
  50. :_Logica
  51.  
  52. if not %binary:O-I=%==%binary% goto _Axiomatica
  53. if not %binary:I-I=%==%binary% goto _Axiomatica
  54. set /a count=%count%+1
  55. :_Lenguaje formal
  56. set binary=%binary:-=%
  57.  
  58. :_Recursion
  59. if not %binary:I=%==%binary% goto _aritmetica
  60.  
  61. :_Tesis
  62.  
  63.  
  64. echo %count%
  65. goto credits
  66.  
  67.  
  68.  
  69. :credits
En línea

Páginas: [1] 2 Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Ayuda con funcion de libreria de funciones u.u
Scripting
FranciskoAsdf 0 2,227 Último mensaje 9 Septiembre 2008, 04:15 am
por FranciskoAsdf
Python, funciones o libreria ?
Scripting
EvilGoblin 2 6,375 Último mensaje 11 Julio 2010, 20:35 pm
por xーいぱ
Ayuda con Scripts Batch. Por favor.
Scripting
legolas266 1 2,895 Último mensaje 25 Febrero 2013, 17:05 pm
por Eleкtro
Make Batch Files - software para crear tus batch-scripts de forma sencilla
Scripting
Eleкtro 3 3,123 Último mensaje 2 Marzo 2018, 15:11 pm
por **Aincrad**
[APORTES][SHELL SCRIPT][ACTUALIZADO] Interfaz CLI + Scripts varios.
Scripting
W17CH3R 8 3,787 Último mensaje 1 Abril 2020, 18:53 pm
por W17CH3R
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines