Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API function to return the "System Drive" 2

Status
Not open for further replies.

Adeybaby

Programmer
Dec 22, 2003
2
GB
Hi all

I currently use ENVIRON("SYSTEMDRIVE") to return the system drive from the system environment variable, usually this is "C:".

I understand that environment variables are not the best way to get this information, and I have used API calls to return all of the other folders I need (windows folder, progam files etc) but cannot find one for the system drive.

Anybody know if there is one?
Thanks for any help!
Ade
 
Adeybaby, welcome to Tek-Tips try using the FileSystemObject.

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Const SystemFolder = 1
MsgBox fso.GetSpecialFolder(SystemFolder)
 
Thanks Joe. I can use that and check for the leftmost character for the drive letter.

Thanks for the prompt answer!

Adeybaby
 
MsgBox fso.GetDriveName(fso.GetSpecialFolder(SystemFolder))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top