ASP GetAbsolutePathName 方法

GetAbsolutePathName 方法為指定路徑返回從根驅動器開始的完整路徑。
語法
FileSystemObject.GetAbsolutePathName(path)
參數 | 描述 |
---|---|
path | 必需的。需修改為完整路徑的路徑。 |
實例
假設當前目錄是 c:\temp\test:實例 1
<%
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("c:")
response.write(path)
%>
輸出:
c:\temp\test
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("c:")
response.write(path)
%>
輸出:
c:\temp\test
實例 2
<%
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("mydoc.txt")
response.write(path)
%>
輸出:
c:\temp\test\mydoc.txt
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("mydoc.txt")
response.write(path)
%>
輸出:
c:\temp\test\mydoc.txt
實例 3
<%
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("private\mydoc.txt")
response.write(path)
%>
輸出:
c:\temp\test\private\mydoc.txt
dim fs,path
set fs=Server.CreateObject("Scripting.FileSystemObject")
path=fs.GetAbsolutePathName("private\mydoc.txt")
response.write(path)
%>
輸出:
c:\temp\test\private\mydoc.txt
