Issue to shell command

Peter_1985 2,736 Reputation points
2021-02-16T05:37:05.25+00:00

Hi,
Can you help to error like
68468-a10.png

due to 2nd line below?

                    Command0 = "cmd /c copy /y ""C:\cmp3g\CODECO_ERROR_a\" & File0 & """ ""C:\cmp3g\CODECO_ERROR_a\" & Str0 & """ "  
                    Shell (Command0)  
Community Center Not monitored
{count} votes

Accepted answer
  1. Xingyu Zhao-MSFT 5,381 Reputation points
    2021-02-17T01:45:46.16+00:00

    Hi @Peter_1985 ,
    In order to copy the file, try:

            Command0 = "cmd.exe /c copy /y C:\cmp3g\CODECO_ERROR_a\" & File0 & " C:\cmp3g\CODECO_ERROR_a\" & Str0  
            Shell(Command0)  
    

    Hope it could be helpful.

    Best Regards,
    Xingyu Zhao
    *
    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Peter_1985 2,736 Reputation points
    2021-02-17T03:00:26.31+00:00

    Hi,
    Due to issue like
    68809-a13.png
    for last line below

                        sSrcFile = "C:\cmp3g\CODECO_ERROR_a\" & File0    
                        sDesFile = "C:\cmp3g\CODECO_ERROR_a\" & Str0    
                        CreateObject("Wscript.Shell").Run "cmd /c copy /y " & Chr(34) & sSrcFile & Chr(34) & " " & Chr(34) & sDesFile & Chr(34), 0, True    
    

    What permission should be adjusted below?
    68941-a17.png


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.