The FILECOPY command
#5
'Question is in PowerBASIC for Windows section, so changed Albert's code
'to PBWin from PBCC.
'
'I was curious if FileA is itself the running EXE containing FILECOPY.
'But that works fine also. (see #COMPILE line)
'
Code:
#compile exe "test.exe"
#dim all
'
function pbmain () as long
    local sFileA as string
    local sFileB as string
    sFileA = "test.exe"    ' This running program
    sFileB = "copy_of_test.exe"
    filecopy sFileA,sFileB
    if err then
      'stderr str$(err)+": "+error$(err)
      ? str$(err)+": "+error$(err)
    end if
    if isfile(sFileB)=0 then
      'stderr "Filecopy did not succeed."
      ? "Filecopy did not succeed."
    end if
    ? "done"
end function '
'that leaves CHDR "D:\Test_with_Files"
'1. is the program that is doing the FILECOPY in D:\Test_with_Files ?
'2. if FileA is not in D:\Test_with_Files it will not be found by FILECOPY.
'
'code in post 1 had no error checking and PB does not display "messages"
'unless asked.
'
'Cheers,
Reply


Messages In This Thread
The FILECOPY command - by Tillmann Viefhaus - 06-15-2025, 05:04 PM
RE: The FILECOPY command - by Albert Richheimer - 06-15-2025, 06:00 PM
RE: The FILECOPY command - by Tillmann Viefhaus - 06-15-2025, 06:21 PM
RE: The FILECOPY command - by Albert Richheimer - 06-15-2025, 07:50 PM
RE: The FILECOPY command - by Dale Yarker - 06-16-2025, 12:17 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)