Skip to content

Instantly share code, notes, and snippets.

@eggist77
Last active February 10, 2021 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eggist77/a35cf8f6a39df6e95c1954f0bd8e67f9 to your computer and use it in GitHub Desktop.
Save eggist77/a35cf8f6a39df6e95c1954f0bd8e67f9 to your computer and use it in GitHub Desktop.
hatena: entry/20200411/1586561707
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
'1.Get ScriptFile folder
MsgBox fso.getParentFolderName(WScript.ScriptFullName)
'2.C:\Windows\System32
MsgBox fso.getParentFolderName("C:\Windows\System32\notepad.exe")
'3.notepad.exe
MsgBox fso.GetFileName("C:\Windows\System32\notepad.exe")
'4 C:\Windows\System32
MsgBox fso.GetFile("C:\Windows\System32\notepad.exe").ParentFolder
'5 notepad
MsgBox fso.GetBaseName("C:\Windows\System32\notepad.exe")
'6 exe
MsgBox fso.GetExtensionName("C:\Windows\System32\notepad.exe")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment