Unable to resolve user environment variable correctly
Posted
by
Junaid
on Stack Overflow
See other posts from Stack Overflow
or by Junaid
Published on 2012-08-28T08:36:26Z
Indexed on
2012/08/28
9:38 UTC
Read the original article
Hit count: 322
I am trying to resolve %USERPROFILE%
using WScript.Shell
. When I create a vbs file and run directly from Windows, I get the correct path for the logged-in user C:\Documents and Settings\Administrator
but it gets resolved to C:\Documents and Settings\Default User
instead of logged-in user when I used it inside my classic ASP webapp running on the local machine on IIS.
The code I used is as below
var oShell = new ActiveXObject("Wscript.Shell");
var userPath = oShell.ExpandEnvironmentStrings("%USERPROFILE%");
Is there a permission/setting which I need to check to get correct value of USERPROFILE
when retrieving value from the webapp?
PS: I am using javascript to code.
© Stack Overflow or respective owner