Open In App

ASP GetDriveName Method

Last Updated : 02 Mar, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

The ASP GetDriveName Method is used to return a string value that specifies the name of the drive for the specified path. It is a predefined method of the FileSystem Object.

Syntax 

FileSystemObject.GetDriveName(path) 

Parameter Values 

path: It is a required attribute. It specifies the complete path of the file from which the drive name returns.

Example 1: Below code demonstrates the ASP GetDriveName Method. 

Javascript




<%
dim fs,dname
set fs=Server.CreateObject("Scripting.FileSystemObject")
dname=fs.GetDriveName("d:\hello\sudo.html")
Response.Write(dname)
set fs=nothing
%>


Output:

d

Example 2: 

Javascript




<%
dim fs,dname
set fs=Server.CreateObject("Scripting.FileSystemObject")
dname=fs.GetDriveName("C:\inetpub\wwwroot\asptest\GFG.txt")
Response.Write(dname)
set fs=nothing
%>


Output:

c

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads