Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. echo *****************************
  3. echo (c) Michael Plusnin, 2010
  4. echo *****************************
  5.  
  6. setlocal ENABLEDELAYEDEXPANSION
  7. set asd=EXTERNAL
  8. set dsa=INTERNAL
  9. set ex=0
  10. call :touppercase %1
  11. call :main %1
  12. call :help %aaa%
  13. if %asd%==EXTERNAL (
  14.     if %dsa%==INTERNAL echo None command
  15. )
  16. endlocal
  17. exit /b
  18.  
  19. :help
  20. for /f "skip=1" %%a in ('help ^| findstr /r /c:"^[A-Z][A-Z]*" ') do (
  21.     if %%a==%1 (
  22.         set dsa=0
  23.         echo Internal command
  24.     )
  25. )
  26. exit /b
  27.  
  28. :main
  29.  
  30.     rem for /l %%e in (1,1,25) do call :pathext %%e "" %1
  31.     rem call :wext "" %1
  32.     call :wext "" %1 local
  33.     set a=1
  34.     :whilemain
  35.         if %asd%==EXTERNAL (
  36.             call :parsepath %a% %1
  37.         )
  38.         if NOT %ex%==%a% exit /b
  39.         set /a a=%a%+1
  40.     goto :whilemain
  41.  
  42. exit /b
  43.  
  44. :parsepath
  45.     for /F "delims=; tokens=%1" %%b in ("%PATH%") do (
  46.         rem echo %%b
  47.         if %asd%==EXTERNAL (
  48.             rem echo asdgas
  49.             call :wext "%%b" %2 non
  50.         )
  51.         if %%b NEQ "" set ex=%1
  52.         rem echo %%b
  53.     )
  54. exit /b 1
  55.  
  56. :wext
  57. set exbs=0
  58. set bs=1
  59.     :whileext
  60.         call :pathext %bs% %1 %2 %3
  61.         if %asd%==0 goto :eof
  62.         if NOT %exbs%==%bs% goto :eof
  63.         set /a bs=%bs%+1
  64.        
  65.     goto :whileext
  66. goto :eof
  67.    
  68. :pathext
  69.     for /F "delims=; tokens=%1" %%d in ("%PATHEXT%") do (
  70.         if NOT %4==local (
  71.             rem echo %2\%3%%d
  72.             if exist %2\%3%%d (
  73.                     set asd=0
  74.                     echo External command
  75.             )
  76.         ) else (
  77.             rem echo %3%%d
  78.             if exist %3%%d (
  79.                     set asd=0
  80.                     echo External command
  81.             )
  82.         )
  83.         rem if %%d NEQ ""
  84.         set exbs=%1
  85.         rem exit /b 4
  86.     )
  87. goto :eof
  88.  
  89. :touppercase
  90.     set aaa=%1
  91.     set aaa=%aaa:q=Q%
  92.     set aaa=%aaa:w=W%
  93.     set aaa=%aaa:e=E%
  94.     set aaa=%aaa:r=R%
  95.     set aaa=%aaa:t=T%
  96.     set aaa=%aaa:y=Y%
  97.     set aaa=%aaa:u=U%
  98.     set aaa=%aaa:i=I%
  99.     set aaa=%aaa:o=O%
  100.     set aaa=%aaa:p=P%
  101.     set aaa=%aaa:a=A%
  102.     set aaa=%aaa:s=S%
  103.     set aaa=%aaa:d=D%
  104.     set aaa=%aaa:f=F%
  105.     set aaa=%aaa:g=G%
  106.     set aaa=%aaa:h=H%
  107.     set aaa=%aaa:j=J%
  108.     set aaa=%aaa:k=K%
  109.     set aaa=%aaa:l=L%
  110.     set aaa=%aaa:z=Z%
  111.     set aaa=%aaa:x=X%
  112.     set aaa=%aaa:c=C%
  113.     set aaa=%aaa:v=V%
  114.     set aaa=%aaa:b=B%
  115.     set aaa=%aaa:n=N%
  116.     set aaa=%aaa:m=M%
  117. goto :eof
  118.  
  119. -------------------------------------------
  120.  
  121. @echo off
  122. echo *****************************
  123. echo (c) Michael Plusnin, 2010
  124. echo *****************************
  125.  
  126.  
  127.  
  128. echo %*
  129. call :sc %*\
  130. goto :eof
  131.  
  132.  
  133. :sc
  134. rem echo %*
  135. for /F %%x in ('dir "%*" /a:-D /B') do (
  136.     echo %*%%x
  137.     echo %ERRORLEVEL%
  138. )
  139. for /F "tokens=3,*" %%i in ('dir "%*" /a:D ^| findstr "<DIR>"') DO (
  140.     if NOT %%j==. (
  141.         if NOT %%j==.. (
  142.             echo %*%%j
  143.             call :sc %*%%j\
  144.         )
  145.     )
  146. )
  147. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement