Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
Related: stackoverflow.com/q/9435607/516290 –  Diogo Jul 31 '12 at 18:16
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.