Directory problems?
-
How can I tell my program to read the folders that are different on peoples computers like mine for example. C:\Documents and Settings\Code Crapper\Cookies Now as you can see your computer has not got that, your computer (if its XP) would have. Drive letter:\Documents and Settings\Your Name\Cookies So my question is, how do I get it to work on anybodys computer? do I have to do something like this? %systemroot%\DOCU~\%USER%\Cookies ???? :~
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
-
How can I tell my program to read the folders that are different on peoples computers like mine for example. C:\Documents and Settings\Code Crapper\Cookies Now as you can see your computer has not got that, your computer (if its XP) would have. Drive letter:\Documents and Settings\Your Name\Cookies So my question is, how do I get it to work on anybodys computer? do I have to do something like this? %systemroot%\DOCU~\%USER%\Cookies ???? :~
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
Are you trying to access the "Documents and Settings" folder, or the current user's folder?
-
Are you trying to access the "Documents and Settings" folder, or the current user's folder?
I need to get through the bit that says Code Crapper, the user name because otherwise the program wont work on any other computer with a different user name. So far I have "C:\DOCUME~1\username (dont work)" The 'DOCUME~1' bit works but I just need the username bit, I tried 'USER~1'and 'USERNA~1' but no luck. All I need to know is the Username one and then I can do things like. C:\DOCUME~1\Username?\Cookies I can do anything else which does not require a user name too like C:\DOCUME~1\All Users\LOCALS~1\
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
-
I need to get through the bit that says Code Crapper, the user name because otherwise the program wont work on any other computer with a different user name. So far I have "C:\DOCUME~1\username (dont work)" The 'DOCUME~1' bit works but I just need the username bit, I tried 'USER~1'and 'USERNA~1' but no luck. All I need to know is the Username one and then I can do things like. C:\DOCUME~1\Username?\Cookies I can do anything else which does not require a user name too like C:\DOCUME~1\All Users\LOCALS~1\
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
Ok, for the current user, just use the path variable
%HOMEPATH%
, which specifies "C:\Documents and Settings\Current User". If that doesn't work, then you could try accessing the registry key:HKEY_Current_User\Volatile Environment\HOMEPATH
-- modified at 22:31 Wednesday 29th November, 2006
-
Ok, for the current user, just use the path variable
%HOMEPATH%
, which specifies "C:\Documents and Settings\Current User". If that doesn't work, then you could try accessing the registry key:HKEY_Current_User\Volatile Environment\HOMEPATH
-- modified at 22:31 Wednesday 29th November, 2006
Thank you, that really helped me, I can now make a full on computer cleaner if I put the time in :-D Thanks again!
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
-
How can I tell my program to read the folders that are different on peoples computers like mine for example. C:\Documents and Settings\Code Crapper\Cookies Now as you can see your computer has not got that, your computer (if its XP) would have. Drive letter:\Documents and Settings\Your Name\Cookies So my question is, how do I get it to work on anybodys computer? do I have to do something like this? %systemroot%\DOCU~\%USER%\Cookies ???? :~
--------------------------- If I had a £0.01 for the amount of times I have said to people "USE GOOGLE" I would be richer than Bill Gates.
The way to get the path to the root of the users profile is to use the
Environment.GetEnvironmentVariable
method:Dim userPath As String = Environment.GetEnvironmentVariable("USERPROFILE")
The proper way to get the path to the current users Cookies folder is different:
Dim cookiePath As String = Environment.GetFolderPath(Environment.SpecialFolder.Cookies)
Dave Kreskowiak Microsoft MVP - Visual Basic