Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Getting connected Flashdrive list

dwmorenojrdwmorenojr Posts: 1Member
I am trying to get a list of connected Flash drives that appear horizonally
like this:
Connected Drives: [color=Blue]H: I: J: K: L:[/color]

My Problem is when I perform the variable substitution I get a nul. I have researched for 3 weeks now, and have come to the conclusion that it may not be possible. Can anyone get this code to work???

REM --------------SETUP-------------------
rem ---> setup vbs file <---
echo > "vbs.vbs" Set objSWbemServices = GetObject("winmgmts:\.")
echo >>"vbs.vbs" Set colSWbemObjectSet = objSWbemServices.InstancesOf("Win32_LogicalDisk")
echo >>"vbs.vbs" For Each objSWbemObject In colSWbemObjectSet
echo >>"vbs.vbs" If UCase(objSWbemObject.Description) = "REMOVABLE DISK" Then WScript.Echo objSWbemObject.DeviceID
echo >>"vbs.vbs" next

rem --------get drive list----------------
set LIST=
for /F %%a in ('cscript //nologo "vbs.vbs"') do (
echo %LIST
Sign In or Register to comment.