How to output file to 2 different folders

I want to ask how we output file to 2 different folders. Below is my code that only can output file to one folder. Any changes that I need to make so that it can output the file to 2 different folders?

Code :

)
echo "Hi";
)>"C:\Users\310152922\Desktop\AutomatedScript\Email\validateCOB.txt"

Folder name and file name:

1 : C:\Users\310152922\Desktop\AutomatedScript\Email\validateCOB.txt
2 : C:\Users\310152922\Desktop\AutomatedScript\Backup\validateCOB.txt

Expected output:

It able to create validateCOB.txt in to Email and Backup Folder. Currently it only able to output validateCOB.txt to Email folder.

Thanks for viewing, comments and answers.

Upvotes: 2

Views: 59

Answers (2)

npocmaka
npocmaka

Reputation: 57252

set "file.1=C:\Users\310152922\Desktop\AutomatedScript\Email\validateCOB.txt"
set "file.2=C:\Users\310152922\Desktop\AutomatedScript\Backup\validateCOB.txt"

    for /f "tokens=* delims=" %%N in ('echo "HI"') do (
       (echo(%%N)>>%file.1%
       (echo(%%N)>>%file.2% 

    )

Upvotes: 2

foxidrive
foxidrive

Reputation: 41234

)
echo "Hi";
)>"C:\Users\310152922\Desktop\AutomatedScript\Email\validateCOB.txt"

copy "C:\Users\310152922\Desktop\AutomatedScript\Email\validateCOB.txt" "C:\Users\310152922\Desktop\AutomatedScript\Backup\validateCOB.txt"

Upvotes: 2

Related Questions