Click here to Skip to main content
16,018,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on the final part of my application, but before I can publish it, I need to know how to copy a folder containing a .exe and a .txt file to the user's C: Drive upon installation, to be used with the application. I need the folder to be copied to C:, not C:/Program Files with the rest of the app data. Something similar to how Photoshop creates a PSD folder for your project files in the documents folder. Is this possible? Please help!
Posted

1 solution

You can use System.IO.Directory.Copy command to copy the folders. But it is not a good idea to write the the root folder directly.

Any reasons you want to copy to the root folder C: ? Windows 7 does not allow you to copy files to the root folder unless you are an administrator. You may have to reconsider your design.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Feb-12 17:47pm    
Agree, a 5.
--SA
7774tlas 29-Feb-12 11:09am    
Thanks for the info. The reason that I wanted to copy to C: is because I have .exe subprogram that uses "cmd" like a batch file. As I'm not very good at navigating in the command window, I wanted to put it there for convenience. If I copied it the "documents" folder instead, would I have any UAC issues there?
[no name] 29-Feb-12 13:11pm    
Put it in the TEMP folder or in the User Profile folder.
7774tlas 29-Feb-12 14:55pm    
Thank you for you help and knowledge, I used the System.IO.Directory.Copy and the user profile folder, and changed shell locations. Works fine now. Thanks again!
[no name] 29-Feb-12 22:34pm    
You're welcome. Glad that you found it useful.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900