是否可以从批处理文件或cmd脚本向DLL搜索路径添加目录? [英] Is it possible to add a directory to DLL search path from a batch file or cmd script?

查看:433
本文介绍了是否可以从批处理文件或cmd脚本向DLL搜索路径添加目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

推荐答案

您可以将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.

但是,您可以在%PATH%变量中插入您的DLL目录,然后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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆