[<<]Message[>>]    [<<]Author[>>]    [<<]Subject[>>]    [<<]Thread[>>]

Number : 10765 Date : 2005-03-12 Author : John Zeman Subject : Re: XCopy Batch File > XXCopy Size(KB) : 1
--- In xxcopy@yahoogroups.com, "matt_theuma" wrote: > > Hi, > > Can someone explain how I can get the following batch file working > with XXCopy... It works with XCopy, but XXCopy returns an error > saying: The source and/or destination specifiers are allowed only in > the regular command line (or a command file (/CF) in it). > > I take it I have to pass the variables to XXCopy in a different > manner, but I don't know how. > > [BEGIN BATCH FILE] > > SET inputFile=D:\text.txt > > FOR /F "tokens=1,2 delims=," %%i IN (%inputFile%) DO SET source="%%i" > & SET dest="%%j" & call :next > > GOTO :EOF > > :next > > ECHO.F|xCopy %source% %dest% /y /v /z /c > > REM > GOTO :EOF > > [/END BATCH FILE] > > Thanks and regards, > Matthew You cannot pipe your variables, or anything else into xxcopy, which is what the following line attempts to do: ECHO.F|xCopy %source% %dest% /y /v /z /c I realize you have xcopy in that line but for the sake of discussion it doesn't matter as it's invalid syntax either way even though xcopy may allow it to work. Simply remove the ECHO .F| and the script should function. However I would leave the word ECHO in there for a bit to test things first. Also, the success of this will depend upon the exact format of what you have in the D:\text.txt file. If it contains one or more lines similar to this: C:\test folder\source\,C:\test folder\destination\ or C:\test folder\source\file.txt,C:\test folder\destination\ then it should work. If the D:\text.txt file contains lines in ANY other format than the above (i.e. contains quotes (") or lacks a trailing \ for directories, or does not have at least one comma per line) then the script will fail. John
This message if part of XXCOPY's message Archive. The archive contains all the messages posted at Yahoo!Groups: XXCOPY.