Method 1:
① Define API:
Function ulong copyfile (ref string lpexistingfilename, ref string lpnewfilename, ulong bfailifexists) Library kernel32.dll "alias for" copyfilea"
Note: copy an object.
Returned value: ulong. If the value is not zero, the operation is successful. If the value is zero, the operation fails.
Parameter type and description
Lpexistingfilename string, source file name.
Lpnewfilename string, the target file name.
Bfailifexists ulng. If it is set to true (non-zero), function call fails once the target file already exists. Otherwise, the target file is rewritten.
② Script:
String str_source, str_des
Ulong ulng_result
Str_source = "C:/lag.txt" // source file
Str_des = "C:/tmp/111.txt" // target file
Ulng_result = copyfile (str_source, str_des, 0)
If ulng_result <> 0 then
MessageBox ("OK", "file copied successfully! ")
End if
Method 2:
① First process a batch of files lag. BAT:
Copy C:/lag.txt C:/tmp/lll.txt
② InProgramTo call this batch of files:
Run ("lag. Bat ")