méthode ASP GetAbsolutePathName
méthode GetAbsolutePathName renvoie le chemin complet du chemin d'accès spécifié à partir de la racine du lecteur a commencé.
grammaire
FileSystemObject.GetAbsolutePathName(path)
参数 | 描述 |
---|---|
path | 必需的。需修改为完整路径的路径。 |
Exemples
En supposant que le répertoire courant est c: temp \ test \:exemple 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
exemple 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
exemple 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
Complete FileSystemObject Object Reference