Programming Tips



GET CURRENT DEFAULT DRIVE

VB.Net
  • Dim aa As String = CurDir()
    aa = Mid(aa, 1, 1)
    
  • Dim ab As String = FileIO.FileSystem.CurrentDirectory
    ab = Mid(ab, 1, 1)
    
VB6
  • Dim aa As String
    aa = CurDir
    aa = Mid(aa, 1, 1)
    
QuickBasic
  • '$INCLUDE: 'qb.bi'
    DIM Regs AS RegType
    
    Regs.ax = &H1900
    CALL interrupt(&H21, Regs, Regs)
    PRINT "The current drive is "; CHR$((Regs.ax AND &HFF) + 65)
    
    END
    
Interrupt
  • INT 21 - DOS 1+ - GET CURRENT DEFAULT DRIVE
    	AH = 19h
    Return: AL = drive (00h = A:, 01h = B:, etc)
    Note:	Novell NetWare uses the fact that DOS 2.x COMMAND.COM issues this call
    	  from a particular location every time it starts a command to
    	  determine when to issue an automatic EOJ