

InterviewSolution
Saved Bookmarks
1. |
Solve : combining two commands into one? |
Answer» <html><body><p>If a batch file is used to copy a file to two locations, can that be done in one line (if so how ?), or does it require two copy commands ?<a href="https://interviewquestions.tuteehub.com/tag/quote-1175222" style="font-weight:bold;" target="_blank" title="Click to know more about QUOTE">QUOTE</a> from: Sebastian42 on July 04, 2010, 02:48:47 AM</p><blockquote>If a batch file is used to copy a file to two locations, can that be done in one line (if so how ?), or does it require two copy commands ?<br/></blockquote><br/>The syntax of the copy <a href="https://interviewquestions.tuteehub.com/tag/command-11508" style="font-weight:bold;" target="_blank" title="Click to know more about COMMAND">COMMAND</a> is shown in the help you see if you type copy /? at the prompt. Basically in its simplest form it consists of <br/><br/>copy <em>[<a href="https://interviewquestions.tuteehub.com/tag/source-244756" style="font-weight:bold;" target="_blank" title="Click to know more about SOURCE">SOURCE</a>]</em> <em>[<a href="https://interviewquestions.tuteehub.com/tag/destination-244461" style="font-weight:bold;" target="_blank" title="Click to know more about DESTINATION">DESTINATION</a>]</em><br/><br/>You can make <em>source</em> be more than one file by using wildcards, for example copy *.txt foldername but <em>destination</em> can only be one thing - one file or one folder.<br/><br/>However you can put more than one command on one line if you use the & <a href="https://interviewquestions.tuteehub.com/tag/character-242304" style="font-weight:bold;" target="_blank" title="Click to know more about CHARACTER">CHARACTER</a>, for example:<br/><br/>copy file1.txt "C:\A folder" & copy file1.txt "D:\Another folder"<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/></body></html> | |