How can I use GetProfilesDirectory to retrieve c:\Documents and Settings or c:\Users (for vista and win7) in Jscript?
Or else any alternative way to get the user profile path (not of the current user) but for any given user in a Non-AD scenario.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can’t use the
GetProfilesDirectoryfunction in JScript, because Windows Script Host doesn’t support calling Windows API functions. However, you can get the profiles directory path from theHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectoryregistry value. Here’s an example:The abovementioned
ProfileListregistry key has subkeys corresponding to different users. The user’s profile path is specified by theProfileImagePathvalue of the appropriate subkey.