vbs获取自身文件名,不带格式,不带路径

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

猜你喜欢

转载自www.cnblogs.com/lnd-blog/p/12445440.html