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