Guest User

Untitled

a guest
Dec 13th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. set a=1234567890123
  2.  
  3. if [%a:~0,-12%]==[] (
  4. echo a is shorter than 13
  5. ) else (
  6. echo %a% is longer than 12
  7. )
  8.  
  9. set a=1234567890123
  10.  
  11. if [%a:~0,-12%]==[] (
  12. echo a is shorter than 13
  13. ) else (
  14. echo %a% is longer than 12
  15. )
  16.  
  17. @echo off
  18. setlocal enabledelayedexpansion
  19. for /F "tokens=1 delims=" %%i in ('dir /o:-n /b /s') do (
  20. set filename=%%i
  21. set part=!filename:~0,260!
  22. if !filename! NEQ !part! echo !filename!
  23. )
  24.  
  25. @ECHO OFF
  26.  
  27. SETLOCAL ENABLEDELAYEDEXPANSION
  28.  
  29. set Limit=%~1
  30. echo Paths being found which exceed !Limit!
  31. echo ======================================
  32. type NUL > "!temp!tabulator.txt"
  33. FOR /F "tokens=1 delims=" %%A IN ('dir /o:-n /b /s') DO (
  34. set Test=%%A
  35. call :_cnt_str_len
  36. echo/!test!
  37. echo/!_cnt_str_len!
  38. timeout /t 100
  39. rem :: call set Test=%%Test:~%Limit%%%.
  40. IF "!_cnt_str_len!" GEQ "!Limit!" (
  41. type NUL > "!temp!pathlengthdeterminationtemp.txt"
  42. echo %%A > "!temp!pathlengthdeterminationtemp.txt"
  43. FOR /F "tokens=1 delims=" %%H IN ('dir /s /o /b "!temp!pathlengthdeterminationtemp.txt"') DO set StrLen=%%~zH
  44. del "!temp!pathlengthdeterminationtemp.txt"
  45. set /a StrLen=!StrLen!-2
  46. echo !StrLen!,%%A>> "!temp!tabulator.txt"
  47. )
  48. )
  49.  
  50. sort "!temp!tabulator.txt" /O "!temp!tabulator1.txt"
  51. del "!temp!tabulator.txt"
  52. TYPE "!temp!tabulator1.txt"
  53. del "!temp!tabulator1.txt"
  54.  
  55. ENDLOCAL
  56.  
  57. goto :_end_of_file
  58.  
  59. :_cnt_str_len
  60.  
  61. if defined _cnt_str_len set _cnt_str_len=
  62.  
  63. for /f %%h in ('cmd /u /c set /p "=%Test:"= %"^<nul^|find /v /c ""') do (
  64.  
  65. set _cnt_str_len=%%~h&& call set _cnt_str_len=!_cnt_str_len!
  66.  
  67. exit /b
  68.  
  69. )
  70.  
  71. :_end_of_file
Add Comment
Please, Sign In to add comment