im a newbie, so bear with me. could you show me how to make an exe that copies another exe to a specified directory, then run that exe
thanks
Printable View
im a newbie, so bear with me. could you show me how to make an exe that copies another exe to a specified directory, then run that exe
thanks
Put this in a Module, (Remove any Forms from the Project)..
This copies the File: MyFile.exe from C:\Files to C:\NewDir Then Launches MyFile.exe before closing.Code:Sub Main()
FileCopy "C:\Files\MyFile.exe", "C:\NewDir\MyFile.exe"
Shell "C:\NewDir\MyFile.exe", vbNormalFocus
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
i may be wrong, but couldnt you use a DOS batch file for this task??
Then you would have to worry about the distribution and proper placement of the batch file. Why not use 2 lines of code instead? What if he needed to dynamically create a new directory or pass parameters? Batch files are not that flexible....
well what im trying to do is put the files i want copied, onto a CD, so i can put in a system, and load up some programs when i click a button in a little menu. how can i tell it to copy the file, if its in the same directory as the exe. (since its would be on a cd-rom, the address wouldn't always be the same)
Thanks
The App.Path Property returns the Directory Path from Which your Application was Launched, you can use this, ie.
FileCopy App.Path & "\Files\MyFile.exe", "C:\NewDir\MyFile.exe"
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]