【发布时间】:2015-05-06 01:42:51
【问题描述】:
我正在尝试编写一个脚本,它将搜索给定目录,查找以 .ready_go 扩展名结尾的文件,将它们 rar(将 rar 保存为文件名.rar),然后移动到具有相同扩展名的下一个文件并做同样的事情。
我没有运气将变量“文件名”分配给循环中找到的文件名。此变量将用于命名 rar 存档
到目前为止,这是我所拥有的:
set dSource=C:\users\admin\desktop\one
set dTarget=\\filesrv1\archives
set fType=*.ready_go
for /f "delims=" %%f in ('dir /a-d /b /s "%dSource%\%fType%"') do (
set filename=%%f
echo %filename%
echo %dsource%
pause
)
它可以很好地回显 dsources 变量,但不会回显文件名变量。
我也尝试了“echo %%f”,但也没有用。
我们将不胜感激。谢谢。
【问题讨论】:
标签: batch-file command-line cmd command-line-arguments command-prompt