简体   繁体   English

如何复制“程序文件”文件夹中的文件或文件夹

[英]How do I copy a file Or folder in the Program Files folder

How do I copy a file Or folder in the Program Files folder. 如何复制“程序文件”文件夹中的文件或文件夹。

Experimented with: 实验过:

 system("xcopy pro_s\\pro C:\\Program Files  /e /i /h");

But I did not succeed. 但是我没有成功。

Try 尝试

system("xcopy \"C:\\Program Files\\foldertocopy\" \"C:\\destination\" /e /i /h"); // Copy from

system("xcopy \"C:\\source\" \"C:\\Program Files\\foldertocopyinto\" /e /i /h"); // Copy to

The latter will need admin rights. 后者将需要管理员权限。

There is a space in "Program Files" which can cause issues. “程序文件”中有一个空格,可能会引起问题。 Try surrounding it with double quotes \\"C:\\\\Program Files\\" or try with "C:\\\\Progra~1" 尝试用双引号\\"C:\\\\Program Files\\"包围,或尝试使用"C:\\\\Progra~1"

If you are on C++, you can use mighty boost as well: See https://stackoverflow.com/a/2536438 or https://stackoverflow.com/a/8594696 or on windows see SHFileOperation API 如果您使用的是C ++,则还可以使用强大的Boost:请参阅https://stackoverflow.com/a/2536438https://stackoverflow.com/a/8594696,或者在Windows上请参阅SHFileOperation API

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用mkdir()创建文件夹后,如何让程序将文件和其他信息保存到新文件夹中 - After using mkdir() to create a folder how do I have the program save files and other information into the the new folder 保存到 Program Files 文件夹的文件不存在 - File saved to Program files folder is not there 如何将文件从一个文件夹复制到另一个文件夹 - How to copy a file from a folder to another folder 如何编写打开exe文件(spectrawin)并将数据保存到特定名称和文件夹的程序? - How do i write a program that opens an exe file(spectrawin) and saves the data into a specific name and folder? 如何在C ++中编写选择文件夹对话框? - How do I program a select folder dialogue in C++? 如何创建新文件夹并将文件保存到该文件夹​​? - How do i create a new folder and save files to it? C++ | 如何删除位于 (C:\Program Files (x86)) 的文件夹中的文件 - C++ | How can i delete files in a folder located in (C:\Program Files (x86)) 如何使用着色器从文件中的类调用以在包含gl代码的另一个文件中显示(两个文件都位于jni文件夹中)? - how do I call from a class that is in a file to display in another file containing the gl code using shaders (where both files are in jni folder)? 在C ++中,如何验证文件或文件夹路径? - In C++ how do i validate a file or folder path? 我无法使用 C++ 复制文件夹中的所有文件 - I can not make a copy of all the files inside a folder with C ++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM