ASP GetDriveName Method
Last Updated :
02 Mar, 2021
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
Share your thoughts in the comments
Please Login to comment...