Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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'm the using the command dir /AD /B "\\computerName\users\" >> user_export.log

Is it possible to create a batch file that asks the user to enter the Computer Name and then when the end user enters the computer name for it to be entered in the UNC name listed above, so dir /AD /B "\\**INPUT VALUE ENTERED HERE**\users\"

Hopefully this makes sense.

share|improve this question
Related: – Diogo Jul 31 '12 at 18:16

It will be best to isolate the user input from the use of the input in a UNC name. So I could help with the user input:

Just use the set command to get the user response:

set /P response=INPUT VALUE PLEASE
dir /A/D /B "\\%response%\users\"

You can write more sophisticated prompts like

set /P response="INPUT VALUE HERE > "

but the double ticks aren't necessary for the set command. They are requiered to ignored the special character >. Further the visibility of the space characters in the prompt will be improved.

share|improve this answer
Because of your use of the ">" character in the prompt, the quotes are necessary to avoid a syntax error (probably because it looks like output redirection to the shell program). – martineau Jul 31 '12 at 20:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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