Last active
May 8, 2023 00:35
-
-
Save mitaken/ba1b7cf606b6820c41a04c88977a65ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Option Explicit | |
| Call WScript.Quit(Main()) | |
| Function Main() | |
| Main = 0 | |
| Dim ObjShell, StrPaths, AryPaths | |
| Set ObjShell = WScript.CreateObject("WScript.Shell") | |
| StrPaths = ObjShell.ExpandEnvironmentStrings("%PATH%") | |
| Call Debug.WriteLine(StrPaths) | |
| AryPaths = Split(StrPaths, ";") | |
| Dim ObjFSO, StrPath, StrNormalizePath, StrNotExistsPath | |
| Set ObjFSO = WScript.CreateObject("Scripting.FileSystemObject") | |
| StrNotExistsPath = "" | |
| For Each StrPath In AryPaths | |
| If Len(StrPath) > 0 Then | |
| StrNormalizePath = ObjShell.ExpandEnvironmentStrings(StrPath) | |
| Call Debug.WriteLine(StrNormalizePath) | |
| If Not ObjFSO.FolderExists(StrNormalizePath) Then | |
| StrNotExistsPath = StrNotExistsPath + vbCrLf + StrNormalizePath | |
| End If | |
| End If | |
| Next | |
| If StrNotExistsPath <> "" Then | |
| Main = 1 | |
| Call MsgBox(StrNotExistsPath, vbOKOnly + vbExclamation, "Folder Not Exists in Path") | |
| End If | |
| Set ObjFSO = Nothing | |
| Set ObjShell = Nothing | |
| End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment