Batch file 批量重命名/复制/删除不起作用?

Batch file 批量重命名/复制/删除不起作用?,batch-file,file-io,Batch File,File Io,无论出于何种原因,这都不起作用(表示“未找到文件”) 这是在[helper45=7zip命令行可执行文件]之前发生的事情 ren package.temp package.zip copy package.zip %temp% del package.zip helper45 e "%temp%\package.zip" “e”是提取命令。我刚刚注意到一个明显的错误。如果该脚本与您的脚本完全相同,那么错误如下。如果不是,我肯定会因为提供了不正确的信息而否决这个问题 不管怎样,看看下面 两份鹿特

无论出于何种原因,这都不起作用(表示“未找到文件”)

这是在
[helper45=7zip命令行可执行文件]
之前发生的事情

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

“e”是提取命令。

我刚刚注意到一个明显的错误。如果该脚本与您的脚本完全相同,那么错误如下。如果不是,我肯定会因为提供了不正确的信息而否决这个问题

不管怎样,看看下面

两份鹿特丹文件(第1份,共3份):

两份夏威夷文件(第2份,共3份):

两份纽约文件(第3份,共3份):

两份鹿特丹文件(第1份,共3份):

另外两个鹿特丹文件,3个文件中的2个——但上面的“3个文件中的2个”是夏威夷

copy "Titanic Moves 2 of 3 Rotterdam.dat" "%in%"
copy "Titanic Moves 2 of 3 Rotterdam.img" "%in%"
还有两个鹿特丹文件,3个文件中的3个--但是上面的“3个文件中的3个”是NY

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”,并向我们显示错误所在行的复制和粘贴。

我怀疑您尝试复制/删除的文件中至少有一个不存在。通过直接查看错误消息上方(并从批处理中删除
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"

我会使用pushd而不是cd,这样,如果您从其他驱动器调用它,它就会工作。

文件是否确实存在于您的%temp%目录中?^忘记那个注释吧。的确如此。我复制了命令,这样就不用花很多时间了。但现在确实如此。
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"
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"