Set objShell = CreateObject("Wscript.Shell") strPath = Wscript.ScriptFullName '獲取腳本文件全路徑 Set objShell = Nothing Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFile = objFSO.GetFile(strPath) '獲取此文件對象用於后續文件操作 MsgBox objFSO.GetFileName(objFile) '獲取不含路徑的文件名稱,這就是輸出 Set objFile = Nothing Set objFSO = Nothing