Skip to main content

I have to copy a file to the Standard temp Folder of the logged on User.         

move "cswin\\upload\\routeinf.ini" to filename1

move "%localappdata%\\temp\\routeanf.ini" to filename2

CALL "CBL_COPY_FILE"   USING FILENAME1 FILENAME2   RETURNING STATUS-CODE

CBL_COPY_File does not solve the %localappdata%

Who knows the SOLUTION?

Regards Geozak

I have to copy a file to the Standard temp Folder of the logged on User.         

move "cswin\\upload\\routeinf.ini" to filename1

move "%localappdata%\\temp\\routeanf.ini" to filename2

CALL "CBL_COPY_FILE"   USING FILENAME1 FILENAME2   RETURNING STATUS-CODE

CBL_COPY_File does not solve the %localappdata%

Who knows the SOLUTION?

Regards Geozak

CBL_COPY_FILE does not expand environment variables in its arguments. (Nor do any of the other library functions.) You have to expand the environment variable in your program and then use the result to construct the argument for CBL_COPY_FILE.

You can try something like this:

77 env-value pic x(100).
...
display "localappdata" upon environment-name
accept env-value from environment-value
move spaces to filename2
string
    env-value delimited " "
    "\\temp\\routeanf.ini" delimited size
    into filename2
end-string

Note that for the DELIMITED clause for env-value above I used two spaces, in case %localappdata% expands to a spacey path. (This would still give the wrong result if the path contained two consecutive spaces, but people rarely use two consecutive spaces in file and directory names, fortunately.)


I have to copy a file to the Standard temp Folder of the logged on User.         

move "cswin\\upload\\routeinf.ini" to filename1

move "%localappdata%\\temp\\routeanf.ini" to filename2

CALL "CBL_COPY_FILE"   USING FILENAME1 FILENAME2   RETURNING STATUS-CODE

CBL_COPY_File does not solve the %localappdata%

Who knows the SOLUTION?

Regards Geozak

Thank You, that it.