WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: bmclellan on September 12, 2013, 06:22:15 PM

Title: Windows 7 - Users Home Directory
Post by: bmclellan on September 12, 2013, 06:22:15 PM
Hello,

I can't seem to find the function which would tell me what the persons home directory is when running a winbatch script.

i.e. c:\users\<my name>\My Documents

I've been away for a while, and my debug scripts used to just write to c:\temp, but I'm thinking those days are far behind me now!


Thanks
Barry
Title: Re: Windows 7 - Users Home Directory
Post by: Russell_Williams on September 13, 2013, 06:45:37 AM
Are you wanting the local Profile folder? There is a environment variable USERPROFILE on all desktops that points to that.

Or there is an environment variable "TEMP" that usually points to that same place and a temporary folder under it (be aware that path can contain spaces in it)

Or the Home directory in an Active Directory network?
Title: Re: Windows 7 - Users Home Directory
Post by: td on September 13, 2013, 07:02:37 AM
Take your pick.

Code (winbatch) Select

strProfile = Environment("USERPROFILE")
strTemp = Environment("TEMP")
strDocuments = ShortCutDir("{FDD39AD0-238F-46AF-ADB4-6C85480369C7}")
Title: Re: Windows 7 - Users Home Directory
Post by: bmclellan on September 13, 2013, 01:23:45 PM
This is great, thanks for your examples!!


Barry