2013-11-21 23 views
1

我使用這樣的xcopy命令複製文件的目標路徑 -XCOPY命令:如何只顯示

xcopy /y/i/e/f \oldLocation \newLocation 

和我得到的輸出是這樣的:

D:\temp\src\a.txt-> C:\Temp\a.txt 

我需要的XCOPY在複製成功後爲我提供目標文件(僅限C:\Temp\a.txt)的完整路徑。我已經嘗試過/ l標誌,它給出的輸出像 -

D:a.txt 

有沒有辦法做到這一點?或者我必須手動提取目標路徑。

+0

嘗試切換/ q/l。雖然它不會滿足你的要求,但它會接近它。 –

+0

/q/l顯示覆制的文件數量並且沒有文件名稱。 我希望輸出顯示覆制文件的目標路徑 – user3017635

回答

0

爲什麼不使用Powershell?

$oldLocation = "C:\OldFolder\" 
$newLocation = "D:\NewFolder\" 

ForEach ($item in (gci $oldLocation)) { 
    Write-Host $newLocation$item # Tells you what is being copied 
    Copy-Item $item.fullname $newLocation$item 
}