-2

I want to store the address of my test.vbs file within the script itself. Is there a way to find it?

I can't find it on the internet.

user692942
  • 16,398
  • 7
  • 76
  • 175

1 Answers1

-2

Try Dir("test.vbs") or App.Path. It should return your app's filepath.

Ezani
  • 535
  • 3
  • 18
  • 1
    That's not VBScript. – Ekkehard.Horner Feb 21 '17 at 07:06
  • You're right. Its actually a VB6 function. To return the directory, you can use the WShell's File System Objects. e.g. Dim fso: Set fso = CreateObject("Scripting.FileSystemObject"). There are a number of useful fso functions like fso.GetFolder(filename) or fso.FolderExists(file), the latter is similar to the VB6 Dir(file) function which I mentioned. – Ezani Feb 22 '17 at 10:51