|
-
May 6th, 2013, 07:30 PM
#1
Thread Starter
New Member
[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!
-
May 10th, 2013, 08:14 PM
#2
Re: Where does the application start from?
 Originally Posted by xeroized
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:
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|