internet explorer 6 – JavaScript: Retrieving the %APPDIR% Path – Education Career Blog

Is it possible to retrieve the path of %APPDIR% (in Windows XP: C:\Documents and Settings\UserName\Application Data) in JavaScript?

The solution must be supported by Internet Explorer 6.

Background: I want to provide the user with a link to a certain directory beneath %APPDIR%. I first tried <a href="%APPDIR%\MyFolder\"> or <a href="file://%APPDIR%/MyFolder/">, but Internet Explorer 6 doesn’t resolve it. I get a “Windows cannot find ‘file://%APPDIR%/'” error message box.

So my plan is to set the HREF of the link in a JavaScript.

Edit: Actually, VBScript would be fine, too, as long as IE6 supports the solution.

,

I think this should work, but you’ll need to change it a bit to use it via JS: http://www.windowsitpro.com/article/tips/jsi-tip-9956-how-do-i-use-an-environment-variable-in-vbscript-.aspx

Should otherwise be pretty much the same, but “CreateObject(…)” should be “new ActiveXObject(…)”

Not entirely sure whether it will work in the browser directly though. If not, it may not be possible to do in the browser (not this easily at least?)

,

On IE8, Windows XP file://%APPDATA%/MyFolder works for me.

Leave a Comment