📄 asp_ref_drive.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ASP Drive Object</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>ASP Drive Object</h1>
<a href="asp_ref_textstream.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_ref_file.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">The Drive object is used to return information about a local disk drive or a network share.</p>
<hr />
<h2>Examples</h2>
<p><a target="_blank" href="showfile.asp@filename=demo_availablespace">Get the available space of
a specified drive</a><br />
This example demonstrates how to first create a FileSystemObject object, and then use
the AvailableSpace property to get the available space of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_freespace">Get the free space of a
specified drive</a><br />
This example demonstrates how to use the FreeSpace property to get the free space
of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_totalsize">Get the total size of a
specified drive</a><br />
This example demonstrates how to use the TotalSize property to get the total size of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_driveletter">Get the drive letter of a
specified drive</a><br />
This example demonstrates how to use the DriveLetter property to get the drive letter of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_drivetype">Get the drive type of a
specified drive</a><br />
This example demonstrates how to use the DriveType property to get the drive type of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_filesystem">Get the file system of a
specified drive</a><br />
This example demonstrates how to use the FileSystem property to get the file system of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_isready">Is the drive ready?</a><br />
This example demonstrates how to use the IsReady property to check whether a specified drive is ready.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_path">Get the path of a specified drive</a><br />
This example demonstrates how to use the Path property to get the path of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_rootfolder">Get the root folder of a
specified drive</a><br />
This example demonstrates how to use the RootFolder property to get the root folder of a specified drive.</p>
<p><a target="_blank" href="showfile.asp@filename=demo_serialnumber">Get the serialnumber of a
specified drive</a><br />
This example demonstrates how to use the Serialnumber property to get the serialnumber of a specified
drive.</p>
<hr />
<h2>The Drive Object</h2>
<p>The Drive object is used to return information about a local disk drive or a network share.
The Drive object can return information about a drive's type of file system, free space,
serial number, volume name, and more.</p>
<p><b>Note:</b> You cannot return information about a drive's content with the
Drive object. For this purpose you will have to use the Folder object.</p>
<p>To work with the properties of the Drive object, you will have to create an
instance of the Drive object through the FileSystemObject
object. First; create a FileSystemObject object and then instantiate the Drive object
through the GetDrive method or
the Drives property of the FileSystemObject object.</p>
<p>The following example uses the GetDrive method of the FileSystemObject object to
instantiate the Drive object and the TotalSize property to return the total size in bytes of
the specified drive (c:):</p>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<td valign="top"><pre><%
Dim fs,d
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
Response.Write("Drive " & d & ":")
Response.Write("Total size in bytes: " & d.TotalSize)
set d=nothing
set fs=nothing
%></pre>
<p>Output:</p>
<p>Drive c: Total size in bytes: 4293563392</p>
</td>
</tr>
</table>
<p>The Drive object's properties are described below:</p>
<h3>Properties</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
<tr valign="top">
<th width="25%" align="left" valign="top">Property</th>
<th width="75%" align="left" valign="top">Description</th>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_availablespace.asp">AvailableSpace</a></td>
<td valign="top">Returns the amount of available space to a user on a
specified drive or network share</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_driveletter.asp">DriveLetter</a></td>
<td valign="top">Returns one uppercase letter that identifies the local
drive or a network share</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_drivetype.asp">DriveType</a></td>
<td valign="top">Returns the type of a specified drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_filesystem.asp">FileSystem</a></td>
<td valign="top">Returns the file system in use for a specified drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_freespace.asp">FreeSpace</a></td>
<td valign="top">Returns the amount of free space to a user on a
specified drive or network share</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_isready.asp">IsReady</a></td>
<td valign="top">Returns true if the specified drive is ready and false if
not</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_path_drive.asp">Path</a></td>
<td valign="top">Returns an uppercase letter followed by a colon that
indicates the path name for a specified drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_rootfolder.asp">RootFolder</a></td>
<td valign="top">Returns a Folder object that represents the root folder of a specified
drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_serialnumber.asp">SerialNumber</a></td>
<td valign="top">Returns the serial number of a specified drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_sharename.asp">ShareName</a></td>
<td valign="top">Returns the network share name for a specified drive</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_totalsize.asp">TotalSize</a></td>
<td valign="top">Returns the total size of a specified drive or network
share</td>
</tr>
<tr valign="top">
<td valign="top"><a href="prop_volumename.asp">VolumeName</a></td>
<td valign="top">Sets or returns the volume name of a specified drive</td>
</tr>
</table>
<br />
<hr />
<a href="asp_ref_textstream.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="asp_ref_file.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -