WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

DllCall Information

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Mount a Local Directory as a Drive Letter


How to map a local folder to a drive letter...without using the SUBST.EXE.

(Works on NT and 2000, but not available for 9x)
DriveLetter = "Q:"
Path = "C:\Documents And Settings\Me\Desktop"
;-------------------------------------------------------------
;  MAP a local folder to a drive letter
;-------------------------------------------------------------
x = DllCall("Kernel32.dll",long:"DefineDosDeviceA",long:0,lpstr:DriveLetter,lpstr:Path)
if x 
   Message("Map","Map Successful")
else
   Message("Map","Map Failed")
   exit
endif

;-------------------------------------------------------------
;  Remove the mapping made by the previous call
;-------------------------------------------------------------
x = DllCall("Kernel32.dll",long:"DefineDosDeviceA",long:2,lpstr:DriveLetter,lpnull)
if x 
   Message("Unmap","Unmap Successful")
else
   Message("Unmap","Unmap Failed")
   exit
endif 

Article ID:   W15931
File Created: 2004:03:30:15:41:44
Last Updated: 2004:03:30:15:41:44