2009-07-13 58 views
0

在無論何種原因,這是不工作(稱 '找不到文件'),批量重命名/複製/刪除不起作用?

set in=c:\myprogram\_save 
cd %temp% 
ren 1RO.dat "Titanic Moves 1 of 3 Rotterdam.dat" 
ren 12RO.img "Titanic Moves 1 of 3 Rotterdam.img" 
ren 2HA.dat "Titanic Moves 2 of 3 Hawai.dat" 
ren 22HA.img "Titanic Moves 2 of 3 Hawai.img" 
ren 3NY.dat "Titanic Moves 3 of 3 NY.dat" 
ren 33NY.img "Titanic Moves 3 of 3 NY.img" 
copy "Titanic Moves 1 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 1 of 3 Rotterdam.img" "%in%" 
copy "Titanic Moves 2 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 2 of 3 Rotterdam.img" "%in%" 
copy "Titanic Moves 3 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 3 of 3 Rotterdam.img" "%in%" 
del "Titanic Moves 1 of 3 Rotterdam.dat" 
del "Titanic Moves 1 of 3 Rotterdam.img" 
del "Titanic Moves 2 of 3 Rotterdam.dat" 
del "Titanic Moves 2 of 3 Rotterdam.img" 
del "Titanic Moves 3 of 3 Rotterdam.dat" 
del "Titanic Moves 3 of 3 Rotterdam.img" 

這是什麼[helper45 = 7zip commandline executable]之前發生的事情,

ren package.temp package.zip 
copy package.zip %temp% 
del package.zip 
helper45 e "%temp%\package.zip" 

'E' 是提取命令。

+0

文件是否確實存在於%temp%目錄中? – 2009-07-13 18:38:33

+0

當然可以。我檢查了它。 – 2009-07-14 12:30:06

回答

1

我剛注意到一個明顯的錯誤。如果該腳本字面上是你所擁有的,那麼錯誤在下面。如果不是,我敢肯定會提供錯誤信息的問題。

無論如何,請看下面。

兩個鹿特丹文件(3 1):

ren 1RO.dat "Titanic Moves 1 of 3 Rotterdam.dat" 
ren 12RO.img "Titanic Moves 1 of 3 Rotterdam.img" 

兩個夏威夷文件(2 3):

ren 2HA.dat "Titanic Moves 2 of 3 Hawai.dat" 
ren 22HA.img "Titanic Moves 2 of 3 Hawai.img" 

兩個NY文件(3 3):

ren 3NY.dat "Titanic Moves 3 of 3 NY.dat" 
ren 33NY.img "Titanic Moves 3 of 3 NY.img" 

兩個鹿特丹文件(1 of 3):

copy "Titanic Moves 1 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 1 of 3 Rotterdam.img" "%in%" 

另外兩個鹿特丹文件,3箇中的2個 - 但上面的「2/3」文件是Hawai!

copy "Titanic Moves 2 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 2 of 3 Rotterdam.img" "%in%" 

還有兩個鹿特丹文件,其中3個3 - 但上面的「3」3文件是紐約!

copy "Titanic Moves 3 of 3 Rotterdam.dat" "%in%" 
copy "Titanic Moves 3 of 3 Rotterdam.img" "%in%" 

同樣的錯誤出現在下面幾行:

del "Titanic Moves 1 of 3 Rotterdam.dat" 
del "Titanic Moves 1 of 3 Rotterdam.img" 
del "Titanic Moves 2 of 3 Rotterdam.dat" 
del "Titanic Moves 2 of 3 Rotterdam.img" 
del "Titanic Moves 3 of 3 Rotterdam.dat" 
del "Titanic Moves 3 of 3 Rotterdam.img" 

如果沒有幫助,刪除任何從批處理文件「@echo off」時,向我們展示一個拷貝粘貼&從錯誤它發生的行。

1

我會懷疑至少有一個您試圖複製/刪除的文件不存在。您可以通過直接查看錯誤消息(並從批處理中刪除echo off(如果有的話))來查看哪一行發出該錯誤。

此外,你爲什麼要按順序進行重命名,複製和刪除操作?你可以很容易地把它們卷都變成一個移動操作每個文件:

move 1RO.dat "%in%\Titanic Moves 1 of 3 Rotterdam.dat" 
move 12RO.img "%in%\Titanic Moves 1 of 3 Rotterdam.img" 
move 2HA.dat "%in%\Titanic Moves 2 of 3 Hawai.dat" 
move 22HA.img "%in%\Titanic Moves 2 of 3 Hawai.img" 
move 3NY.dat "%in%\Titanic Moves 3 of 3 NY.dat" 
move 33NY.img "%in%\Titanic Moves 3 of 3 NY.img" 
0

所以,如果你是從不同的驅動器它的工作原理調用它我會改用CD的PUSHD。