WinAPI:kernel32:CopyFile: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{PageAuthor|sag47}}
== CopyFile Function ==
== CopyFile Function ==
Reference: http://msdn2.microsoft.com/en-us/library/aa363851.aspx
Reference: http://msdn2.microsoft.com/en-us/library/aa363851.aspx
Line 4: Line 5:
   StrCpy $1 "copy_to"  ;Path of copy file to
   StrCpy $1 "copy_to"  ;Path of copy file to
   StrCpy $2 1 ; only 0 or 1, set 0 to overwrite file if it already exists
   StrCpy $2 1 ; only 0 or 1, set 0 to overwrite file if it already exists
   System::Call 'kernel32::CopyFile(t r0, t r1, b r2) l'
   System::Call 'kernel32::CopyFile(t r0, t r1, b r2) ?e'
   Pop $0 ; pops a bool.  if overwrite is off and there is a file then error will be 1</highlight-nsis>
   Pop $0 ; pops a bool.  if overwrite is off and there is a file then error will be 1</highlight-nsis>
Replace ''copy_from'' with the windows path (C:\myfile.txt) and replace ''copy_to'' with the windows path (C:\mynewfile.txt).
Replace ''copy_from'' with the windows path (C:\myfile.txt) and replace ''copy_to'' with the windows path (C:\mynewfile.txt).


[[WinAPI:kernel32]]
[[WinAPI:kernel32]]
[[Category:System Plugin Examples]]

Latest revision as of 18:31, 7 May 2010

Author: sag47 (talk, contrib)


CopyFile Function

Reference: http://msdn2.microsoft.com/en-us/library/aa363851.aspx

  StrCpy $0 "copy_from" ;Path of copy file from
  StrCpy $1 "copy_to"   ;Path of copy file to
  StrCpy $2 1 ; only 0 or 1, set 0 to overwrite file if it already exists
  System::Call 'kernel32::CopyFile(t r0, t r1, b r2) ?e'
  Pop $0 ; pops a bool.  if overwrite is off and there is a file then error will be 1

Replace copy_from with the windows path (C:\myfile.txt) and replace copy_to with the windows path (C:\mynewfile.txt).

WinAPI:kernel32