views:

72

answers:

2

Hi, i want to copy the files present in a flash drive into hard drives and then run them using a VC++ application. I have a VS 2008..?

+2  A: 

You could use FindFile() to figure out what files are in the folder..

CopyFile(_T("c:\\test"), _T("c:\\test1"), true);

Then ShellExecute(...)

baash05
A: 

Use FindFirstFile / FindNextFile / FindClose to enumerate the files on your flash drive. If you determine the file is an executable (say by checking for a .exe extension), then you use CopyFile to copy them to the hard drive you want.

Once they are copied you can use ShellExecute to start them or else CreateProcess if you want control of the process via a process handle.

Brian R. Bondy