窗口命令创建动态批处理脚本以获取所有“.dll”库和pre附加/refrence:dllname.dll [英] Window command creating a dynamic batch script to get all ".dll" libraries and pre append /refrence:dllname.dll with it
本文介绍了窗口命令创建动态批处理脚本以获取所有“.dll”库和pre附加/refrence:dllname.dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在一个文件夹中有3个dll释放
abc.dll
def.dll
ghi.dll
我希望变量中的输出类似于
/ reference:abc .dll /reference:def.dll /reference:ghi.dll
我尝试过:
I have 3 dlls in a folder "release"
abc.dll
def.dll
ghi.dll
I want the output in a variable to be like
/reference:abc.dll /reference:def.dll /reference:ghi.dll
What I have tried:
I am able to get file names but not able to append "/reference:" with the dll names
To get the file names i am using "dir /b" command
推荐答案
这不是标准格式,因此您需要编写批处理脚本,很可能使用 FOR
命令。
That is not a standard format so you would need to write a batch script, most likely using the FOR
command.
获得解决方案
@echo off
set app = / reference:
setlocal enabledelayedexpansion
for / fdelims =%% a in('dir / b / ad * .dll' )do(
set oldName = %% a
call setfinalname = %% finalname %%% app%!oldName!
)
ECHO%finalname:~1%
暂停> nul
Got the solution
@echo off
set app=/reference:
setlocal enabledelayedexpansion
for /f "delims=" %%a in (' dir /b /a-d *.dll') do (
set oldName=%%a
call Set "finalname=%%finalname%% %app%!oldName!"
)
ECHO %finalname:~1%
pause >nul
这篇关于窗口命令创建动态批处理脚本以获取所有“.dll”库和pre附加/refrence:dllname.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文