Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. @echo off
  2. for /F "eol=| delims=" %%I in ('dir * /AD /B /O-D 2^>nul') do cd "%%I" & goto DoneCD
  3. echo No subdirectory found in: "%CD%"
  4. :DoneCD
  5.  
  6. C:WindowsSystem32cmd.exe /c dir * /AD /B /O-D 2>nul
  7.  
  8. set "DoneCD=" & (@for /F "eol=| delims=" %I in ('dir * /AD /B /O-D 2^>nul') do @if not defined DoneCD cd "%I" & set "DoneCD=1") & set "DoneCD="
  9.  
  10. @set "DoneCD=" & (@for /F "eol=| delims=" %%I in ('dir * /AD /B /O-D 2^>nul') do @if not defined DoneCD cd "%%I" & set "DoneCD=1") & set "DoneCD="
  11.  
  12. @echo off
  13. set "DoneCD="
  14. for /F "eol=| delims=" %%I in ('dir * /AD /B /O-D 2^>nul') do (
  15. if not defined DoneCD (
  16. cd "%%I"
  17. set "DoneCD=1"
  18. )
  19. )
  20. if not defined DoneCD echo No subdirectory found in: "%CD%"
  21. set "DoneCD="
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement