Results 1 to 2 of 2

Thread: [RESOLVED] Where does the application start from?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2013
    Posts
    14

    Resolved [RESOLVED] Where does the application start from?

    For building an installer, I need to know where an application executes from so I can copy files from that directory. For instance, when the files are on a CD (D:\), I need to know to copy from D:\. If the files are on drive E:\ then I need to copy from E:\. I tried using the following code, but I get the temp directory for the application rather than where it originated from:

    Code:
            Dim AppPath As String
            AppPath = Path.GetFullPath(Application.ExecutablePath)
            MsgBox(AppPath)
            Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory(AppPath, "C:\Temp\")
    The returned value of that is "C:\Users\USerName\AppData\Local\Apps\2.0\etc\etc\etc" rather than "D:\" where it is running from.

    Since the program will be running on multiple users computers that won't necessarily have CD-ROM / DVD Drives and may be running the setup from a USB drive, I can't just hard code the starting executable.

    Thanks for any help!

  2. #2
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,500

    Re: Where does the application start from?

    Quote Originally Posted by xeroized View Post
    Since the program will be running on multiple users computers that won't necessarily have CD-ROM / DVD Drives and may be running the setup from a USB drive, I can't just hard code the starting executable.

    Thanks for any help!
    Hi, Xeroized, you might like to try: -
    vb.net Code:
    1. Dim filePath As String = IO.Path.Combine(Application.StartupPath, fileName)
    Where fileName is your Application's Name. (Either in quotes, or in a pre-defined string variable).


    Poppa.
    Along with the sunshine there has to be a little rain sometime.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width