Atrybut Path ASP

Definicja i użycie

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

Komentarz:Dla napędów, ścieżka nie zawiera katalogu głównego. Na przykład, ścieżka napędu C to C:, a nie C:\.

Słowa kluczowe:

DriveObject.Path 
FileObject.Path
FolderObject.Path

Przykład

Przykład dla obiektu Drive

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

Wyjście:

Ścieżka to C:

Przykład dla obiektu File

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

Wyjście:

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

Przykład dla obiektu Folder

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

Wyjście:

Ścieżka: D:\asp\test