I'm writing a short batch program to copy *.doc

The files are in directories where it's name can be changed. In each directory, only have one folder only.

If in DOS command window, i'll just key-in cd <press-TAB>, then it will show the first available directory (or in my case, the only folder that have in that current directory)


C:\Book2014> cd "press-TAB"
C:\Book2014> cd English     // the only available directory to go

Is there a way of doing this in batch file?

for /d %%F in (*) do cd "%%F" & goto :break

The GOTO is there just in case there are more than 2 folders - it will CD to the first one found.

  • it works man :).. appreciate your help! – Lokman Sep 22 '14 at 6:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.