Atrybut Path w ASP

Definicja i użycie

Atrybut Path służy do zwracania ścieżki dla określonego napędu, pliku lub katalogu.

Sposób użycia:

DriveObject.Path 
FileObject.Path
FolderObject.Path

Przykład dla obiektu Drive

<%
definiuj fs,d
ustaw fs=Server.CreateObject("Scripting.FileSystemObject")
ustaw d=fs.GetDrive("e:")
Response.Write("Ścieżka to " & d.Path)
ustaw d=nic
ustaw fs=nothing
%>

Wynik:

Ścieżka to E:

Przykład dla obiektu File

<%
definiuj fs,f
ustaw fs=Server.CreateObject("Scripting.FileSystemObject")
ustaw f=fs.GetFile("c:\asp\test.asp")
Response.Write("Ścieżka: " & f.Path)
ustaw f=nic
ustaw fs=nothing
%>

Wynik:

Ścieżka to: C:\asp\test.asp

Przykład dla obiektu Folder

<%
definiuj fs,fo
ustaw fs=Server.CreateObject("Scripting.FileSystemObject")
ustaw fo=fs.GetFolder("c:\asp\test")
Response.Write("Ścieżka: " & fo.Path)
ustaw fo=nothing
ustaw fs=nothing
%>

Wynik:

Ścieżka: C:\asp\test