Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am intested in creating a batch file that can read in a text file which has four variables: customer name, customer number, customer order, products orders. I am using:

FOR /F "delims=, tokens=1,2,3,4" %%f in (test.txt)do md g:\%%f\%%g\%%h\%%i

However, it does not seem to create the subdirectories correct.

Can any one help?

share|improve this question

closed as off topic by Zoredache, pauska, Scott Pack, Michael Hampton, Mark Henderson Dec 17 '12 at 0:00

Questions on Server Fault are expected to relate to server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

What output do you see if you replace the md with echo md? Are there spaces in the file name? Why not quote them path? – Zoredache Oct 6 '11 at 22:31

I suspect you may have spaces in some of the parameters. Try this:

FOR /F "delims=, tokens=1,2,3,4" %%f in (test.txt) do md "g:\%%f\%%g\%%h\%%i"
share|improve this answer

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