【发布时间】:2021-10-14 17:40:31
【问题描述】:
这是我的 bat 文件:
setlocal EnableDelayedExpansion
set DebugLibNames=
for /f "delims=" %%a in ('"dir /s/b *.lib ..\3rdlib\Debug\ 2>nul"') do (
set DebugLibNames=%%DebugLibNames%%, %%a
)
echo DebugLibNames:%DebugLibNames%
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
lib.exe /OUT:world.lib %DebugLibNames%
pause
我想要的是获取一个 lib 文件名列表,然后用 lib.exe 将它们打包到一个大 lib 中。
但是,DebugLibNames 是空的,我该如何解决?
【问题讨论】:
-
将行
set DebugLibNames=%%DebugLibNames%%, %%a替换为set DebugLibNames=!DebugLibNames!, %%a... -
还要注意命令行长度有限制,因此您需要注意目录树的深度和其中的 lib 文件数量。
标签: windows batch-file cmd command-line