#include <Windows.h>#include<stdio.h>intMainintargc, Ptchar argv[]) { //printf ("Number:%d\n", argc); //printf ("First:%s\n", argv[0]); //printf ("Second:%s\n", argv[1]); //printf ("Third:%s\n", argv[2]); if(0= = LSTRCMP ("- D", argv[1]) && ARGC = =3) { if(! DeleteFile (argv[2]) {printf ("Delete File send error:%x\n", GetLastError ()); } Else{printf ("Delete file succeeded. \ n"); } } Else if(0= = LSTRCMP ("- C", argv[1]) && ARGC = =4) { if(! CopyFile (argv[2],argv[3],true)) {if(GetLastError () = =0x50) {printf ("The file%s already exists, is it overwritten? Y/S", argv[3]); if('y'==GetChar ()) { if(! CopyFile (argv[2], argv[3] (FALSE)) {printf ("Copy File send error:%d\n", GetLastError ()); } Elseprintf ("copy file succeeded \ n"); } } } Elseprintf ("copy file succeeded \ n"); } Else if(0= = LSTRCMP ("- M", argv[1]) && ARGC = =4) { if(MoveFile (argv[2], argv[3]) {printf ("Error Renaming file:%d\n", GetLastError ()); } Else{printf ("Rename file succeeded. \ n"); } } Else{printf ("Command Error! "); } System ("Pause"); return 0;}
File operations: DeleteFile, CopyFile, MoveFile