How can i make a copy of my program and paste it in another location??
Printable View
How can i make a copy of my program and paste it in another location??
If you are talking about a physical disk file, then don't bother with copy 'n paste, just make a copy of it using VB's FileCopyVB Code:
FileCopy "c:\fido_glc.exe, "c:\backup\fido_glc.exe"
But i don`t know the location of the original prog.
I think there is a code that gets the original location but don`t know it. :D
App.Path specifies the path of the project .VBP file when running the application from the development environment or the path of the executable file when running the application as an executable file.
Ok. I'm guessing this means that your users could install it anywhere they want to and you have no way of knowing where, right?Quote:
Originally Posted by fido_glc
And you need to find out where it is so you can make a backup of it?
Once, you have the location (and I can show you how to do that providing I'm right about what is going on) do you want to make a special backup folder? Once you know where it is, where do you want to copy it to?
Here is some example code to get the path, create a backup folder and copy the exe file (also works if user renames file)
VB Code:
'Get the app path Dim strPath As String strPath = App.Path If Right(strPath, 1) <> "\" Then strPath = strPath & "\" End If 'Make backup folder MkDir "c:\Backup\" 'Copy the app exe file FileCopy strPath & App.EXEName & ".exe", "c:\Backup\" & App.EXEName & ".exe"