#Include once "windows.bi" #include "file.bi" 'uses API and CAN DETECT if there is a disc in drive A: 'can't remember wherefrom I got GetVolumeInformation() but I'm glad to have it, so thx ;-)) #define BufLen 255 Function GetAllDrives(ShowLine As Integer=FALSE) As String Var s="", Drives="", Drive="", i=0, j=0, Serial=0, IsDriveReady=0, VName=Space(BufLen), FSName=Space(BufLen) Dim As String LwTyp(1 To 6)={"Medium unknown", "removable Medium", "HardDisk", "NetDrive", "CD/DVD", "RamDisk"} Dim Buffer As String*BufLen i=GetLogicalDriveStrings(BufLen, Buffer) Drives=Left(Buffer, i) For i=0 To Len(Drives)-1 If Drives[i]=0 Then Drives[i]=32 'Space instead of Chr(0)!! Next If ShowLine Then For i=0 To Len(Drives)-1 Step 4 s &=Chr(Drives[i]) &": " Next Return s EndIf For i=1 To Len(Drives) Step 4 Drive=Chr(Drives[i-1], Drives[i], Drives[i+1]) 'only a test to avoid Mid(Drives, i, 3) ;-)) IsDriveReady=GetVolumeInformation(StrPtr(Drive), StrPtr(VName), BufLen, @Serial, 0, 0, StrPtr(FSName), BufLen) j=GetDriveType(Drive) s &=" " &Chr(Drive[0]) &*IIf(IsDriveReady, @!":\tyes ", @!":\tno") &!"\t[" &LwTyp(IIF(j<2 Or j>6, 0, j)) &!"]\n" Next Return Left(s, Len(s)-1) End Function Var ShowSingle=lcase(Command(1))="-s", Eniki=InStr(lcase(Command), "-n")=0 'yes, I DO like the var-command! Select Case lcase(Command(1)) Case "-h", "-?", "/h", "/?", "--help" Print !"AllDrives.Bas\nSyntax:\nAllDrives [[-s]|[-h]] [-n]\nWhere:\n" &_ !" -s\tshows DriveChars(with :) in a single line..\n" &_ !" -h\t(with it's variants) remains undocumented^^\n" &_ !" -n\tsuppresses the keypress at the end..\n" &_ !"Parameterstart changed from '/' to '-', because it's easier to access.."; If Eniki Then GetKey End 194 'return an errorlevel to show that help has been called.. End Select If ShowSingle=0 Then Print "Drives of " &Environ("Computername"); Print *IIf(ShowSingle, @"", @!":\nDrive\tready\tType\nw8 plz..\r"); GetAllDrives(ShowSingle); If Eniki Then GetKey End