Click to See Complete Forum and Search --> : INI file and UserProfile


shers
February 3rd, 2009, 05:32 AM
Hi,

Is there a way to manually store a value to get the user profile path of a user in the INI file?

Thanks

PeejAvery
February 3rd, 2009, 10:00 AM
What INI file are you talking about? If you want to just get the current user's profile path why not use the environment variable %UserProfile%.

shers
February 3rd, 2009, 10:19 PM
Yes, I would like to know if this variable can be used in the INI file? For example, I need a string as follows:

"Q:\test;%UserProfile%\Application Data"

Can this be accomplished?

Thanks

PeejAvery
February 4th, 2009, 07:41 AM
I repeat my questions. You keep saying "the INI file"...What INI file are you talking about?

Second, any modern programming language can just plain read environment variables. If you just would use the environment variable %UserProfile%, you would have no reason to access any INI file.

shers
February 7th, 2009, 11:39 PM
I agree with you that %UserProfile% would read the user profile. But I need to get a set of paths at one stretch in a particular order as follows

Path = Q:\test;C:\Documents and Settings\shers\test;.......

where Q is a network drive.

Thanks

PeejAvery
February 8th, 2009, 07:41 AM
So why don't you just concatenate the string by using %UserProfile% plus the other parts? The language in which you plan to write this will affect how you obtain the user profile variable, but the rest is basic to programming.

path = "Q:\test;" & userProfile & "\test;......."

shers
February 8th, 2009, 10:59 PM
I tried that too. But it takes the whole string as string.

PeejAvery
February 9th, 2009, 08:08 AM
But it takes the whole string as string.
What? :confused: That sentence makes no sense.

HanneSThEGreaT
February 9th, 2009, 10:47 AM
Have a look here as well :
http://www.codeproject.com/KB/vb/appsettings2005.aspx

thomus07
February 9th, 2009, 10:50 AM
Second, any modern programming language can just plain read environment variables. If you just would use the environment variable %UserProfile%, you would have no reason to access any INI file.

I don't understand how it will expand. Please show me what I am not getting. I think it is ExpandEnvironmentStrings (http://msdn.microsoft.com/en-us/library/ms724265%28VS.85%29.aspx) API to do this job :confused:

tossy
February 10th, 2009, 03:34 AM
You can store anything you want too in an ini file. If this data is sensitive then you would have to encrypt it so users can't read it and copy it.

Ini files don't have to be your.ini they can be any file extension you want to use providing it doesn't clash with the other extension registered to Windows. It could be your.dll and it could be padded out with any rubbish just to make the filesize to a small dll size rather that a few Kb.