# DOS Batch File with Prompts



## angelr82 (Jun 15, 2010)

So I am trying to make a simple batch file that some non-tech folks that need to query active directory can easily pull members of a specific group. Here is what i have so far and it works just fine but I cant fully figure out how to make it prompt for the users input (AD_Group) and then choice to open the output (yes or no).

As you can see I tried to put some simple instructions but I'm afraid that too is just too much for them.

Any suggestions?

echo **************************READ ME**********************************
echo ****You're about to Query Active Directory for a list of users ****
echo ****To specify the group you will need to edit this BAT file ****
echo ****To Edit this file please Right Click this BAT file ->Edit ****
echo ****Only Edit what is between the quotes ("") ****
echo *******************************************************************
pause
echo ****Output will be saved to your desktop as "AD_UserQuery.TXT" **** 
pause
dsquery group -samid "AD_Group" | dsget group -members -expand >%UserProfile%\Desktop\AD_UserQuery.TXT


----------



## Squashman (Apr 4, 2003)

Look at the help for the SET command.


```
set /p group=Please type in group name:
```


----------



## antmar904 (Feb 22, 2010)

@echo off
cls
set /p group=Enter AD group name:
dsquery group -samid "%group%" | dsget group -members -expand >"c:\temp\AD_UserQuery_%group%.TXT"
pause


----------

