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. Change startup dir

Change startup dir

Scheduled Pinned Locked Moved Visual Basic
question
5 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
    cstrader232
    wrote on last edited by
    #1

    Sorry, I'm sure this is obvious... When I start my program from a shortcut in Vista the default directory becomes c:\windows\system32. How do I make the default directory the path that the .exe is actually in? Thanks

    _ 1 Reply Last reply
    0
    • C cstrader232

      Sorry, I'm sure this is obvious... When I start my program from a shortcut in Vista the default directory becomes c:\windows\system32. How do I make the default directory the path that the .exe is actually in? Thanks

      _ Offline
      _ Offline
      _Damian S_
      wrote on last edited by
      #2

      In XP, you can set the "Start In" directory in the shortcut itself. Can you not do this with a Vista shortcut? Of course, there are VB functions to get the App Directory from within code if this is what you are after...

      I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!

      C L 2 Replies Last reply
      0
      • _ _Damian S_

        In XP, you can set the "Start In" directory in the shortcut itself. Can you not do this with a Vista shortcut? Of course, there are VB functions to get the App Directory from within code if this is what you are after...

        I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!

        C Offline
        C Offline
        cstrader232
        wrote on last edited by
        #3

        I don't see any way to change the "start in" value in Vista. In any case there must be a way to change the default directory programmatically.

        1 Reply Last reply
        0
        • _ _Damian S_

          In XP, you can set the "Start In" directory in the shortcut itself. Can you not do this with a Vista shortcut? Of course, there are VB functions to get the App Directory from within code if this is what you are after...

          I don't have ADHD, I have ADOS... Attention Deficit oooh SHINY!! Booger Mobile (n) - A bright green 1964 Ford Falcon - our entry into the Camp Quality esCarpade!! Do something wonderful - make a donation to Camp Quality today!!

          L Offline
          L Offline
          LCARS x32
          wrote on last edited by
          #4

          If I understand you correctly, the following should work:

          System.IO.Directory.SetCurrentDirectory("c:\myfolderpath")

          Hope that helps. -Ray

          C 1 Reply Last reply
          0
          • L LCARS x32

            If I understand you correctly, the following should work:

            System.IO.Directory.SetCurrentDirectory("c:\myfolderpath")

            Hope that helps. -Ray

            C Offline
            C Offline
            cstrader232
            wrote on last edited by
            #5

            Hi Ray, Totally helps. What I really needed, which I figured out thanks to your message, was: System.IO.Directory.SetCurrentDirectory(Application.StartupPath) I knew it had to be simple!

            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