none
VB Script to Open Windows Explorer to the Folder Where the Script is Located RRS feed

  • Question

  • The below VB Script was created to Open Windows Explorer to the Folder Where the Script is Located; however, it is no longer working properly with Win 10.

     

    On Error Resume Next

    Set objShell = CreateObject("Wscript.Shell")

    strPath = Wscript.ScriptFullName

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set objFile = objFSO.GetFile(strPath)

    strFolder = objFSO.GetParentFolderName(objFile)

    strFolder = LCase(strFolder)

    tmpPath = Left(strFolder, 16)

    If tmpPath = "\\core01\clients" Then

        strFolder = Replace (strFolder, tmpPath, "G:")

    End If

    strPath = "explorer.exe /e," & strFolder

    objShell.Run strPath


    • Edited by KGA-1 Wednesday, March 14, 2018 9:41 PM
    • Moved by Bill_Stewart Tuesday, May 8, 2018 7:09 PM Not a question
    Wednesday, March 14, 2018 8:44 PM

All replies

  • Please post your code correctly.   Please post it using the code posting tool provided on the edit bar.  Edit you original post and cut and paste the code correctly without a huge number of blank lines.


    \_(ツ)_/

    Wednesday, March 14, 2018 8:49 PM