1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
| @echo off & setlocal enabledelayedexpansion enableextensions
set str=%*
if not defined str (set /p str=Entrez une chaine: %)
echo.
call :length "%str%"
call :count "%str%"
call :reverse "%str%"
call :ucase "%str%"
call :2hexa "%str%"
call :cword "%str%"
call :def "%str%"
call :defRev "%str%"
call :DecToHex1 2657
call :DecToHex2 2657
call :fileRev "my file.txt"
set length
set [
set reverse
set ucase
set hexa
set cword
set $hex1
set $hex2
pause & endlocal & goto:eof
:length
for /f "tokens=1* delims=[]" %%a in ('
"%comspec% /u /c echo:%~1|more|find /n /v """
') do set /a "length=%%a-4"
goto:eof
:count
for /f %%: in ('
"%comspec% /u /c echo:%~1|more|sort"
') do Set /A "[%%:]+=1"
goto:eof
:reverse
for /f "tokens=1* delims=:" %%a in ('
"%comspec% /u /c echo:%~1|more|findstr /o ."
') do set "reverse=%%b!reverse!"
goto:eof
:ucase
for /f "tokens=1* delims=µ" %%a in ('
"tree \µµµ%1|find ":\""
') do set "ucase=%%b"
goto:eof
:2hexa
<nul>$asc$ set/p"=%~1"
for /l %%i in (1 1 %length%) do <nul>>$hex$ set/p"=µ"
for /f "skip=1 tokens=3" %%i in ('fc /b $hex$ $asc$') do set "hexa=!hexa!%%i-"
set "hexa=%hexa:~0,-1%" & del $asc$ $hex$
goto:eof
:cword
Set/Acword=0,cword=1+%str: =,cword+=1+%
goto:eof
:def
for /l %%a in (0 1 %length%) do (
for /l %%i in (1 1 1000) do >nul ver
<nul call Set/p"=%%str:~%%a,1%%"
)
echo.
goto:eof
:defRev
for /l %%a in (%length% -1 0) do (
for /l %%i in (1 1 1000) do >nul ver
<nul call Set/p"=%%str:~%%a,1%%"
)
echo.
goto:eof
:DecToHex1
::
: Idée de Carlos (voir source)
::
set $hex1=0x0
for /f "tokens=1* delims=0=" %%a in ('"%comspec% /cexit/b %1&set;|find "^=ExitCode^=""') do Set $hex1=0x%%b
goto :eof
:DecToHex2
::
: Idée de 01MDM (voir source)
::
for /f "tokens=1,3" %%i in ('^(
reg add hkcu\console /v $hex2 /t reg_dword /d %1 /f ^&
reg query hkcu\console /v $hex2 ^&
reg delete hkcu\console /v $hex2 /f
^)^|find "REG_DWORD"') do Set %%i=%%j
goto:eof
:fileRev
echo.&echo ##########[ BEGIN ]#######################
echo.
for /f "tokens=1* delims=][" %%s in ('find /n /v "" ^< %1') do (
Set "table[%%s]=%%t"
if not defined table[%%s] set table[%%s]=µµµ
Set nline=%%s
)
for /l %%i in (%nline% -1 1) Do (
for /f "tokens=1* delims=µ=" %%o in ('"2>nul set table[%%i]"') do echo=%%p
)
echo.&echo ##########[ END ]#########################
echo.
goto:eof |
Partager