取得指定磁碟機的可用空間數:本例示範如何首先建立一個FileSystemObject對象,然後使用AvailableSpace屬性來獲得指定磁碟機的可用空間。
取得指定磁碟機的可用空間數:本例示範如何首先建立一個FileSystemObject對象,然後使用AvailableSpace屬性來獲得指定磁碟機的可用空間。取得指定磁碟機的剩餘空間容量:本例示範如何使用FreeSpace空間屬性來取得指定磁碟機的剩餘空間。取得指定磁碟機的總容量:本例演
Drive 對象
注意:本執行個體教程因為和具體空間的磁碟機有關,所以運行結果請自行測試,不再提供運行結果。
取得指定磁碟機的可用空間數
本例示範如何首先建立一個FileSystemObject對象,然後使用AvailableSpace屬性來獲得指定磁碟機的可用空間。
本執行個體代碼如下:
<html>
<body>
<%
Dim fs, d, n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "磁碟機:" & d
n = n & "<br>以位元組計的可用空間:" & d.AvailableSpace
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的剩餘空間容量
本例示範如何使用FreeSpace空間屬性來取得指定磁碟機的剩餘空間。
本執行個體代碼如下:
<html>
<body>
<%
Dim fs, d, n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "磁碟機:" & d
n = n & "<br />以位元組計的剩餘空間:" & d.FreeSpace
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的總容量
本例示範如何使用TotalSize屬性來獲得指定磁碟機的總容量。
本文是網頁教學(http://www.webjx.com)收集整理或者原創內容,轉載請註明出處!
本執行個體代碼如下:
<html>
<body>
<%
Dim fs,d,n
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set d=fs.GetDrive("c:")
n = "磁碟機:" & d
n = n & "<br>以位元組計的總容量:" & d.TotalSize
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的磁碟機字母
本例示範如何使用DriveLetter屬性來獲得指定磁碟機的磁碟機字母。
本執行個體代碼如下:
<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("磁碟機字母是:" & d.driveletter)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的磁碟機類型
本例示範如何使用DriveType屬性來獲得指定磁碟機的磁碟機類型。
本執行個體代碼如下:
<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("磁碟機類型是:" & d.DriveType)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的檔案系統資訊
本例示範如何使用FileSystem來取得指定磁碟機的檔案系統類型。
本文由網頁教學網(http://www.webjx.com)整理髮布!轉載請註明出處,謝謝!
本執行個體代碼如下:
<html>
<body>
<%
dim fs, d, n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("檔案系統是:" & d.FileSystem)
set d=nothing
set fs=nothing
%>
</body>
</html>
磁碟機是否已就緒?
本例示範如何使用IsReady屬性來檢查指定的磁碟機是否已就緒。
本執行個體代碼如下:
<html>
<body>
<%
dim fs,d,n
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
n = "此 " & d.DriveLetter
if d.IsReady=true then
n = n & " 磁碟機已就緒。"
else
n = n & " 磁碟機未就緒。"
end if
Response.Write(n)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的路徑
本例示範如何使用Path屬性來取得指定磁碟機的路徑。
本執行個體代碼如下:
<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("路徑是:" & d.Path)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的根資料夾
本例示範如何使用RootFolder屬性來取得指定磁碟機的根資料夾。
本執行個體代碼如下:
<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("根檔案是:" & d.RootFolder)
set d=nothing
set fs=nothing
%>
</body>
</html>
取得指定磁碟機的序號
本例示範如何使用Serialnumber屬性來取得指定磁碟機的序號。
本文由網頁教學網(www.webjx.com)發布!轉載和採集的話請不要去掉!謝謝。
本執行個體代碼如下:
<html>
<body>
<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("序號:" & d.SerialNumber)
set d=nothing
set fs=nothing
%>
</body>
</html>