xcopy支持*通配符,甚至允许您克隆整个目录结构。我的项目使用了我需要分发的这些Qt库:
Qt5CLucene.dll
Qt5Core.dll
Qt5Gui.dll
Qt5Help.dll
Qt5Multimedia.dll
Qt5Network.dll
Qt5PrintSupport.dll
Qt5Sql.dll
Qt5Svg.dll
Qt5Widgets.dll
Qt5Xml.dll
Qt5XmlPatterns.dll它们并不都在Qt安装中的同一个目录中,列表可能会更改,特别是添加。因此,我想使用通配符/*/在目录树中的任何位置找到一个文件:
C:\Qt\5.3.0-64> xcopy ".\*\%NAME%.dll" "%~dp0\release"它不起作用,文件找不到。这是完整的代码:
C:
cd C:\Qt\5.3.0-64\
For %%a in (
"Qt5CLucene"
"Qt5Core"
"Qt5Gui"
"Qt5Help"
"Qt5Multimedia"
"Qt5Network"
"Qt5PrintSupport"
"Qt5Sql"
"Qt5Svg"
"Qt5Widgets"
"Qt5Xml"
"Qt5XmlPatterns"
) do (
xcopy ".\**\%%~ad.dll" "%~dp0\debug"
)因此,我是否可以避免键入完整的路径(例如。( qtbase\bin\Qt5CLucene)在批次中?
发布于 2015-10-21 11:36:15
尝试这样做(xcopy可以问您是否想要创建目录-拷贝被使用):
For /r "C:\Qt\5.3.0-64\" %%a in (
"*Qt5CLucene.dll"
"*Qt5Core.dll"
"*Qt5Gui.dll"
"*Qt5Help.dll"
"*Qt5Multimedia.dll"
"*Qt5Network.dll"
"*Qt5PrintSupport.dll"
"*Qt5Sql.dll"
"*Qt5Svg.dll"
"*Qt5Widgets.dll"
"*Qt5Xml.dll"
"*Qt5XmlPatterns.dll"
) do (
copy /y "%~fa" "%~dp0\debug"
)发布于 2015-10-21 11:34:43
如果我正确理解了您的意思,您希望将C:\Qt\5.3.0-64\ -folder中的所有*.dll文件复制到脚本文件文件夹的调试子文件夹中。
你可以试试这样的方法:
:: Start of your *.bat or *.cmd file
FOR /R C:\Qt\5.3.0-64\ %%a IN (*.dll) DO (
xcopy "%%~a" "%dp~0debug\"
)
:: End of your *.bat or *.cmd filehttps://stackoverflow.com/questions/33257912
复制相似问题