'This Example Demonstrates How To Use The "GetExtensionName" Method To
'Get The File Extension Of The Last Component In A Specified Path.
Dim Fso, FileExtension
Set Fso = CreateObject("Scripting.FileSystemObject") 'Creates "FileSystemObject" Object.
FilePath = InputBox("Enter Full Path Of The File : ","File Path") 'Get Path Of The File
FileExtension = Fso.GetExtensionName(FilePath) 'Returns Extension Of The Specified File.
MsgBox "Extension Of : " & FilePath & " Is - " & FileExtension
=====================================================================
Sub wOut(Var)
on error resume next
Wscript.StdOut.Write(Var)
End Sub
on error resume next
vPath = Wscript.Arguments(0)
vOption = Wscript.Arguments(1)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set vFile = FSO.GetFile(vPath)
vFilename = FSO.GetBaseName(vPath)
vExtension = FSO.GetExtensionName(vPath)
vType = vFile.Type
Select case vOption
case "filename": wOut(vFilename)
case "extension": wOut(vExtension)
case "type": wOut(vType)
End Select
if err <> 0 then wOut("")
On error goto 0
'RPA 종합' 카테고리의 다른 글
RPA의 개념 (2) | 2020.10.13 |
---|---|
RPA 서비스의 변화 방향[2020.07.08] (2) | 2020.06.16 |
RPA 시장의 두드러지는 흐름 (9) | 2020.04.06 |
move file하는 vbs 코드 (0) | 2020.01.03 |
RPA용 SAP GUI 세팅에 관한 설명 (0) | 2019.11.18 |