Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- echo *****************************
- echo (c) Michael Plusnin, 2010
- echo *****************************
- setlocal ENABLEDELAYEDEXPANSION
- set asd=EXTERNAL
- set dsa=INTERNAL
- set ex=0
- call :touppercase %1
- call :main %1
- call :help %aaa%
- if %asd%==EXTERNAL (
- if %dsa%==INTERNAL echo None command
- )
- endlocal
- exit /b
- :help
- for /f "skip=1" %%a in ('help ^| findstr /r /c:"^[A-Z][A-Z]*" ') do (
- if %%a==%1 (
- set dsa=0
- echo Internal command
- )
- )
- exit /b
- :main
- rem for /l %%e in (1,1,25) do call :pathext %%e "" %1
- rem call :wext "" %1
- call :wext "" %1 local
- set a=1
- :whilemain
- if %asd%==EXTERNAL (
- call :parsepath %a% %1
- )
- if NOT %ex%==%a% exit /b
- set /a a=%a%+1
- goto :whilemain
- exit /b
- :parsepath
- for /F "delims=; tokens=%1" %%b in ("%PATH%") do (
- rem echo %%b
- if %asd%==EXTERNAL (
- rem echo asdgas
- call :wext "%%b" %2 non
- )
- if %%b NEQ "" set ex=%1
- rem echo %%b
- )
- exit /b 1
- :wext
- set exbs=0
- set bs=1
- :whileext
- call :pathext %bs% %1 %2 %3
- if %asd%==0 goto :eof
- if NOT %exbs%==%bs% goto :eof
- set /a bs=%bs%+1
- goto :whileext
- goto :eof
- :pathext
- for /F "delims=; tokens=%1" %%d in ("%PATHEXT%") do (
- if NOT %4==local (
- rem echo %2\%3%%d
- if exist %2\%3%%d (
- set asd=0
- echo External command
- )
- ) else (
- rem echo %3%%d
- if exist %3%%d (
- set asd=0
- echo External command
- )
- )
- rem if %%d NEQ ""
- set exbs=%1
- rem exit /b 4
- )
- goto :eof
- :touppercase
- set aaa=%1
- set aaa=%aaa:q=Q%
- set aaa=%aaa:w=W%
- set aaa=%aaa:e=E%
- set aaa=%aaa:r=R%
- set aaa=%aaa:t=T%
- set aaa=%aaa:y=Y%
- set aaa=%aaa:u=U%
- set aaa=%aaa:i=I%
- set aaa=%aaa:o=O%
- set aaa=%aaa:p=P%
- set aaa=%aaa:a=A%
- set aaa=%aaa:s=S%
- set aaa=%aaa:d=D%
- set aaa=%aaa:f=F%
- set aaa=%aaa:g=G%
- set aaa=%aaa:h=H%
- set aaa=%aaa:j=J%
- set aaa=%aaa:k=K%
- set aaa=%aaa:l=L%
- set aaa=%aaa:z=Z%
- set aaa=%aaa:x=X%
- set aaa=%aaa:c=C%
- set aaa=%aaa:v=V%
- set aaa=%aaa:b=B%
- set aaa=%aaa:n=N%
- set aaa=%aaa:m=M%
- goto :eof
- -------------------------------------------
- @echo off
- echo *****************************
- echo (c) Michael Plusnin, 2010
- echo *****************************
- echo %*
- call :sc %*\
- goto :eof
- :sc
- rem echo %*
- for /F %%x in ('dir "%*" /a:-D /B') do (
- echo %*%%x
- echo %ERRORLEVEL%
- )
- for /F "tokens=3,*" %%i in ('dir "%*" /a:D ^| findstr "<DIR>"') DO (
- if NOT %%j==. (
- if NOT %%j==.. (
- echo %*%%j
- call :sc %*%%j\
- )
- )
- )
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement