是否可以从批处理文件或cmd脚本添加目录到DLL搜索路径? [英] Is it possible to add a directory to DLL search path from a batch file or cmd script?
问题描述
MSDN表示, SetDllDirectory())功能可用于将目录插入 DLL搜索路径。可以从批处理文件或cmd脚本访问此功能,也可以通过 cscript ?
MSDN says that the function SetDllDirectory() can be used to insert a directory into the DLL Search Path. Can this function be accessed from a batch file or cmd script, perhaps using via cscript?
目的是让我们的开发版本的dll在%WINDIR%等之前的旧版之前找到,而无需编写程序
The aim is to have our development version of a dll found before a pre-existing older one in %WINDIR% etc. without having to write a program just for that.
提前感谢您的时间和想法。
Thanks in advance for your time and thoughts.
推荐答案
p>您可以将DLL放在与可执行文件相同的路径中,该文件首先在%WINDIR%之前进行搜索。没有办法直接从批处理文件中调用SetDllDirectory。
You can place the DLL in the same path as the executable, which is searched first before %WINDIR%. There's no way to call SetDllDirectory from a batch file directly.
但是,您可以将DLL目录插入到%PATH%变量中,然后Windows会在那里找到DLL 。
But, you can insert your DLL directory in the %PATH% variable, and Windows will then find the DLL there.
set PATH=C:\path to your dll;%PATH%
这篇关于是否可以从批处理文件或cmd脚本添加目录到DLL搜索路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!