thanks again for the help.
but in the situation that im going to be using this code in, i wont really be able to specifically filter a device, because my batch app searches for available drives on the PC and then once they're all found i want it to copy the user-name, computer-name, time-stamp & device info all over into a .txt file into the root of each specific drive. so each drive found will have a report.txt sent the root of its drive with only its corresponding drive info inside it and not any of the other drives infos..
this is just a ruft draft template of how i hope to do this..
im pretty sure it wont work this way, but could you please help me edit it to make it work propperly. thanks.
there 2 .vbs files im using in conjuction with my batch code they are: drivetype.vbs & DriveInfo.vbs..
drivetype.vbs is used with the batch code to find all avaible dives on the pc.
DriveInfo.vbs is the code you gave me to copy the drive infos over into a .txt file.
DriveType.vbs
-------------------------------------------------------------------------
Option Explicit
Dim filesys,Drives,DriveLetter,DriveType,DiskDrive,drtype
set filesys = CreateObject("Scripting.FileSystemObject")
For Each DiskDrive in filesys.Drives
DriveLetter = DiskDrive.DriveLetter
DriveType = DiskDrive.DriveType
select case DriveType
case 0: drtype = "Unknown"
case 1: drtype = "Removable"
case 2: drtype = "Fixed"
case 3: drtype = "Network"
case 4: drtype = "CD-ROM"
case 5: drtype = "RAM Disk"
end Select
WScript.Echo "Drive "&DriveLetter &" is :" &drtype
Next
-----------------------------------------------------------------------
-----------------------------------------------------------------------
DriveInfo.vbs
-----------------------------------------------------------------------
On Error Resume Next
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
Set WshShell = CreateObject("Wscript.Shell")
Username = WshShell.ExpandEnvironmentStrings("%Username%")
Compname = WshShell.ExpandEnvironmentStrings("%Computername%")
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_DiskDrive", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Device: " & objItem.Caption
WScript.Echo "Type: " & objItem.Description
WScript.Echo "Model: " & objItem.Model
WScript.Echo "Name: " & objItem.Name
WScript.Echo
Next
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_CDROMDrive", "WQL", _
wbemFlagReturnImmediately + wbemFlagForwardOnly)
WScript.Echo Username & "__" & Compname & "__" & Date & "__" & Time
For Each objItem In colItems
WScript.Echo "Device: " & objItem.Caption
WScript.Echo "Type: " & objItem.Description
WScript.Echo "Manufacturer: " & objItem.Manufacturer
WScript.Echo "Name: " & objItem.Name
Next
----------------------------------------------------------------------------
----------------------------------------------------------------------------
BATCH CODE APP
----------------------------------------------------------------------------
CD %SYSTEMDRIVE%
for /f "tokens=1,2,3,4,5,6 delims=: " %%A in ('cscript /nologo DriveType.vbs') do (
if "%%D"=="Fixed" (
Echo Copying Info To "FIXED DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
if "%%D"=="CD-ROM" (
Echo Copying Info To "CD-ROM DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
if "%%D"=="Removable" (
Echo Copying Info To "REMOVABLE DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
if "%%D"=="Network" (
Echo Copying Info To "NETWORK DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
if "%%D"=="Unknown" (
Echo Copying Info To "UNKNOWN DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
if "%%D"=="RAM Disk" (
Echo Copying Info To "RAM DISK DRIVE" %%B:\
cscript //nologo DriveInfo.vbs > %%B:\report.txt
)
)
so what needs to be fixed..??