program cannot copy itself?

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

xenogen

Thread Starter
Joined
Jan 12, 2008
Messages
50
i know this sounds like virus but its really not. i had a bit of an issue with file associations and a moving executable and figured the best way to fix it was have the program copy itself to its own resources directory when it runs (if it isn't already there) and ran into a problem. Program wont copy itself. could someone show me a way around this, or another way to do file associations when the executable is not always in the same place? btw i am using VB .NET
 
Joined
Jan 20, 2002
Messages
433
well, if it's not a virus, then it sounds like some kind of spyware.
this is really not appropriate for TechGuy.org
 

xenogen

Thread Starter
Joined
Jan 12, 2008
Messages
50
the program is not a virus or spyware or malicious in any way. the reason i want it to copy itself is that i want the executable to be moveable, so standalone, but i also want file associations to work, and as far as i know file associations require a fixed executable path, so, i want to add in that the program checks for the existence of My documents\Pyroguide\Pyroguide.exe (pyroguide is the name of the program) and if it isn't there, creates it, and the file association is linked to that executable, so that if its run from an associated file, it will run that copy of the program, but it can still be run from the executable you move.

pfft retarded subject..
 
Joined
Jan 20, 2002
Messages
433
If you are trying to make the app portable, you might want to check out PortableApps.com or Google for "portable apps". There is an active community of people trying to create applications that can work from any path.

I don't think that there is a portable way to do file associations, at least not anything that's standard. You can certainly create your own launcher that handles portable associations (see for example xyplorer, an advanced Explorer replacement that has a model for portable file associations).
 
Joined
Jul 9, 2008
Messages
44
If what your are trying to do is move the program from one location to a default location then the best thing to do is use the shell function.
Code:
Shell("cmd /c copy currentfilelocation defaultfilelocation",AppWinStyle.Hide)
To get the current file location you can use the property Environment.CurrentDirectory. This will only give the folders so you have to add "\program.exe" to the string you are using.
 
Joined
Sep 12, 2003
Messages
20,583
i know this sounds like virus but its really not. i had a bit of an issue with file associations and a moving executable and figured the best way to fix it was have the program copy itself to its own resources directory when it runs (if it isn't already there) and ran into a problem. Program wont copy itself. could someone show me a way around this, or another way to do file associations when the executable is not always in the same place? btw i am using VB .NET
Hi xenogen,

Please answer a question or two.

An executable program usually resides on hard drive disk and is loaded into memory for execution. All programs when loaded into memory are loaded for execution to a particular place in memory to execute from.

1) Are you talking about moving the executable file on disk to another location on disk prior to loading and executing it:

In the first case, you would simply need to know the file's location in the file system by virtue of its absolute path name, and then just invoke the interfaces to open a new file by the same name in another path, or give it another name in the same file directory it resides.

2) or, are you talking about making the executable position independent in memory and moving its location to another available memory location during execution dynamically?

-- Tom
 
Joined
Sep 25, 2007
Messages
290
Why not just make a proper installer for the program, that allows the user to choose the installation directory and sets up the associations? What you are describing is a hack.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top