Search code examples
windowsvbscriptwindows-shell

windows shell - how to detect the current location where script file is placed?


I am trying the windows shell file which will be inserted in the folder where it will analyze folders content.

Now i would like to know how can i detect which is the current path ? i.e. location where the vbs file is placed using FileSystemObject?

Set objFSO = CreateObject("Scripting.FileSystemObject")


Solution

  • Set objFS = CreateObject("Scripting.FileSystemObject")
    WScript.Echo objFS.GetParentFolderName(WScript.ScriptFullName)