Atrybut Path w ASP
Definicja i użycie
Atrybut Path służy do zwracania ścieżki do określonego napędu, pliku lub katalogu.
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:\.
Schemat:
DriveObject.Path FileObject.Path FolderObject.Path
Przykład dotyczący obiektu Drive
<% definiuj 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 %>
Wynik:
Ścieżka to C:
Przykład dotyczący obiektu File
<% definiuj fs,f ustaw fs=Server.CreateObject("Scripting.FileSystemObject") ustaw f=fs.GetFile("c:\asp\test\test.asp") Response.Write("Ścieżka: " & f.Path) ustaw f=nothing ustaw fs=nothing %>
Wynik:
Ścieżka to: C:\asp\test\test.asp
Przykład dotyczący 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