# Batch file help.



## jstanley823 (Feb 19, 2013)

hi im trying to make a batch file where the user is prompted to select a drive. how do i write it in a batch where the user can select any drive and it will show that drives space.


----------



## Squashman (Apr 4, 2003)

WMIC LOGICALDISK GET Name,Size,FreeSpace


----------



## jstanley823 (Feb 19, 2013)

thanks.. that is what I am looking for but I was trying to make it like 

@echo off 
echo userinputpath=please select a drive
then from here what ever drive they use as input will show the free space for that drive.


----------



## Chained (Feb 20, 2013)

You can use the choice command but that requires you to list all the variables. If you want unlimited variables I recommend using:

set /p Input=Please select a drive letter:
:: Test to display the output:
echo %Input

the downside of using this is that they can literally put in anything and obviously, if they type "help" for example, this could cause your script to fail or worse yet do something it's not meant to. If you have a limited number of options I recommend the choice command:

choice /c acefy /m "Please pick the drive to use, A, C, E, F, or Y."
if errorlevel 1 set drive=A
if errorlevel 2 set drive=C
if errorlevel 3 set drive=E
if errorlevel 4 set drive=F
if errorlevel 5 set drive=Y
:: Test to display the output:
echo %drive%


----------

