Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
' Verify if folders in the PATH environment variable exist.
' Results are saved in file %TEMP%\PathDirExists.txt
Set objShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Const ForAppending = 8
FName = objShell.ExpandEnvironmentStrings("%TEMP%") & "\PathDirExists.txt"
Set objTextFile = objFSO.OpenTextFile (FName, ForAppending, True)
'Process system PATH Env Variable
objTextFile.WriteLine("System PATH Variable=============================")
inputText = objShell.Environment("PROCESS").Item("PATH")
'Process user PATH Env Variable
objTextFile.WriteLine("User PATH Variable=============================")
inputText = objShell.Environment("USER").Item("PATH")
outputArray = split(inputText,";")
For each Dir in outputArray
If objFSO.FolderExists(Dir) Then
objTextFile.WriteLine("Yes=" & Dir)
objTextFile.WriteLine("No=" & Dir)
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.
cscript /nologo PathDirExists.vbs
if exist "%TEMP%\PathDirExists.txt" start "title" "%TEMP%\PathDirExists.txt"
From novice to tech pro — start learning today.
Members can enroll in this course at no extra cost.