Page 1 of 1

Unable to copy file using a script

Posted: 09 Jul 2019 03:07
by zBernie
I can run the command below as a script, and it executes without error. But the file is never copied to E:\Documents.

Can someone tell me what I'm doing wrong?

copy "C:\eBooks\Cooking\Family Recipes.docx|E:\Documents";

Re: Unable to copy file using a script

Posted: 09 Jul 2019 03:19
by RalphM
The "|" char is not used to separate source and target of a copy operation, you should look at some examples in the help file.

Re: Unable to copy file using a script

Posted: 09 Jul 2019 03:32
by zBernie
RalphM wrote: 09 Jul 2019 03:19 The "|" char is not used to separate source and target of a copy operation, you should look at some examples in the help file.

These examples from the online help doc clearly show the files separated by a "|" character:

Examples
copy "E:\Test\Test.txt|E:\Test\a\alpha.png";
copy "D:\TestD.txt|E:\TestE.txt|F:\TestF.txt";
copy <clp>; //copy (text or items in clipboard) as items, marked as copied
copy <clp>, "cut"; //copy (text or items in clipboard) as items, marked as cut

Re: Unable to copy file using a script

Posted: 09 Jul 2019 10:30
by PeterH
You did read the documentation of help copy? At least the very first line?

What does it say that it copies to?

Re: Unable to copy file using a script

Posted: 09 Jul 2019 10:39
by RalphM
RalphM wrote: 09 Jul 2019 03:19 The "|" char is not used to separate source and target of a copy operation, you should look at some examples in the help file.
Okay, maybe I should have added: "|" is used to separate different source files but for your intended use you might want to change the command to "copyto" and then you still need to define a target for the operation.

Re: Unable to copy file using a script

Posted: 10 Jul 2019 02:43
by zBernie
RalphM wrote: 09 Jul 2019 10:39
RalphM wrote: 09 Jul 2019 03:19 The "|" char is not used to separate source and target of a copy operation, you should look at some examples in the help file.
Okay, maybe I should have added: "|" is used to separate different source files but for your intended use you might want to change the command to "copyto" and then you still need to define a target for the operation.
Thanks, using copyto did what I wanted.