1. #include <windows.h>  
  2. #include <stdio.h>  
  3. #include <string.h>  
  4. #include <stdlib.h>  
  5. void main()  
  6. {  
  7.   char cmd[100]={"xcopy /e "},direct[100]={0},dest[100]={0};   // xcopy /s的意思是复制目录和子目录,除了空的。 /e 空的目录也会被拷贝进去  
  8.   printf("输入要复制的文件夹:   如:C:\\\windows 或 C:\\\Documents and Settings\n");                             
  9.   gets(direct);  
  10.   printf("输入要复制到哪里:     如:C:\\\windows 或 C:\\\Documents and Settings\n");  
  11.   gets(dest);  
  12.   strcat(cmd ,direct);  
  13.   strcat(cmd ," ");  
  14.   strcat(cmd ,dest);  
  15.   system(cmd);  
  16. }