How to get the correct USERPROFILE Windows environment variable in Caché ObjectScript please?
$System.Util.GetEnviron("USERPROFILE") returns "C:\WINDOWS\system32\config\systemprofile". I don't know what that is, but that folder doesn't even exist. The correct value which I need is "C:\Users\robert.steed", as seen via the Windows command line "set" command.
Comments
What account is Caché running under? You'll need to review Windows Services to find the Caché service controller (I don't remember the exact name). It's probably running under the Local System account; you'll need to change it to log on with your own credentials if you want it to use your account's environment.
Thanks Jeffrey. I thought I had replied to your comment already; anyway it was indeed Local System account.
I'm not 100% certain, but I think you could use:
set osuser = ##class(%SYS.ProcessQuery).%OpenId($J).OSUserName
set userprofile = "C:\Users\"_osuserIf Cache isn't running under his account, it likely won't have access to that directory.
Thanks David. It works!