問題:FOR命令的輸出將%〜dpI展開爲一個具有額外\的結尾的路徑,該路徑不適合作爲REPLACE命令的目標路徑。FOR命令將%〜dpI擴展爲帶有額外「」的路徑,不適合替換命令的目標路徑
問題:如何擺脫額外的\?
我想做什麼:如果文件較新,則將文件1.txt複製到C:\ aaa下的每個子目錄。
目錄結構:
c:\aaa
c:\aaa\1
c:\aaa\2
...
使用:
FOR /R C:\aaa %I IN (1.txt) DO REPLACE c:\aaa\1.txt %~dpI /U /R
樣本輸出:
c:\aaa>REPLACE c:\aaa\1.txt c:\aaa\1\ /U /R
Path not found - C:\aaa\1\
no files replaced
c:\aaa>REPLACE c:\aaa\1.txt c:\aaa\2\ /U /R
Path not found - C:\aaa\2\
no files replaced
非常感謝,我在想什麼:) – user2155235 2013-03-11 15:28:49