cn-deng
cn-deng

Reputation: 51

How can I get the folder path using FileSystemObject object in JScript?

What I tried:

function getCurrentPath(){
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    return fso.GetFolder(".").Path;
}

This code is in a HTML file. Now I want to get the folder path the HTML is in.

But it always return the desktop path.

Upvotes: 1

Views: 2643

Answers (1)

GrumpyCrouton
GrumpyCrouton

Reputation: 8621

You can do this with the following code:

var fso = new ActiveXObject("scripting.FileSystemObject");
return fso.GetAbsolutePathName(".");

Upvotes: 1

Related Questions