Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Directory problems?

Directory problems?

Scheduled Pinned Locked Moved Visual Basic
questiontutorial
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Code Crapper
    wrote on last edited by
    #1

    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.

    M D 2 Replies Last reply
    0
    • C Code Crapper

      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.

      M Offline
      M Offline
      MatrixCoder
      wrote on last edited by
      #2

      Are you trying to access the "Documents and Settings" folder, or the current user's folder?

      C 1 Reply Last reply
      0
      • M MatrixCoder

        Are you trying to access the "Documents and Settings" folder, or the current user's folder?

        C Offline
        C Offline
        Code Crapper
        wrote on last edited by
        #3

        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.

        M 1 Reply Last reply
        0
        • C Code Crapper

          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.

          M Offline
          M Offline
          MatrixCoder
          wrote on last edited by
          #4

          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

          C 1 Reply Last reply
          0
          • M MatrixCoder

            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

            C Offline
            C Offline
            Code Crapper
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            • C Code Crapper

              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.

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups