Search code examples
vbscriptfilesystemobject

Get full server path of running VBScript file


is it possible to get the full server path of a VBScript file while it is running, but instead of showing the drive letter, it shows the server name?

I know I can use FileSystemObject's GetAbsolutePath, but instead of it showing S:\Some Folder\FileName.vbs, it shows \\servername\Some Folder\FileName.vbs?


Solution

  • Found the solution, I can retrieve the drive letter using FileSystemObject.GetAbsolutePathName(""), and then use this code to convert the drive letter to the full UNC path, which works well: http://support.microsoft.com/kb/160529