📜  ASP 短路径属性

📅  最后修改于: 2022-05-13 01:56:30.885000             🧑  作者: Mango

ASP 短路径属性

ASP ShortPath 属性用于返回指定文件或文件夹的短路径。

句法:

  • 对于文件对象:

    FileObject.ShortPath
  • 对于文件夹对象:

    FolderObject.ShortPath

下面的示例演示了ASP ShortPath 属性

示例 1:下面的代码说明了 ASP File.ShortPath 属性。

ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Get the file to be used
set f=fs.GetFile("D:\geeksforgeeksfolder\gfglongfilename.txt")
  
'Get the full path of the file
Response.Write("Full Path: " & f.Path)
  
'Get the short path of the file
Response.Write("
Short Path: " & f.ShortPath)    set f=nothing set fs=nothing %>


ASP
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the folder to be used
set f=fs.GetFolder("D:\geeksforgeeksfolder")
  
'Get the full path of the folder
Response.Write("Full Path: " & f.Path)
  
'Get the short path of the folder
Response.Write("
Short Path: " & f.ShortPath)    set f=nothing set fs=nothing %>


输出:

Full Path: D:\geeksforgeeksfolder\gfglongfilename.txt
Short Path: D:\GEEKSF~1\GFGLON~1.TXT

示例 2:下面的代码说明了 ASP Folder.ShortPath 属性。

ASP

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
  
'Getting the folder to be used
set f=fs.GetFolder("D:\geeksforgeeksfolder")
  
'Get the full path of the folder
Response.Write("Full Path: " & f.Path)
  
'Get the short path of the folder
Response.Write("
Short Path: " & f.ShortPath)    set f=nothing set fs=nothing %>

输出:

Full Path: D:\geeksforgeeksfolder
Short Path: D:\GEEKSF~1