如何在不知道路径的情况下获取可执行文件的版本 [英] How to get the version of an executable without knowing the path

查看:81
本文介绍了如何在不知道路径的情况下获取可执行文件的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

回复:如何在不知道路径的情况下获取可执行文件的版本

Re: How to get the version of an executable without knowing the path

具有一个vb.net项目,该项目使用以下内容来执行.bat文件.

Have a vb.net project that uses the following to execute a .bat file.

将psi设置为新的System.Diagnostics.ProcessStartInfo(mPathnFile)

Dim psi As New System.Diagnostics.ProcessStartInfo(mPathnFile)

在bat文件中,它执行可执行文件dtutil而不指定路径.

Inside the bat file it executes the executable dtutil without specifying the path.

dtutil/DestS%SSISSERVER%/FILE%FILENAME%  /COPY SQL;/%PACKAGENAME%/QUIET

dtutil /DestS %SSISSERVER% /FILE %FILENAME%  /COPY SQL;/%PACKAGENAME% /QUIET

dtutil是一个SQL实用程序,SQL将SQL路径插入到系统路径变量中.我的问题是,有时dtutil的版本错误.客户端正在尝试将软件包安装到SQL 2008中,但是path变量指向2005 dtutil.一世 想要检查dtutil的版本并确认其兼容.

dtutil is a SQL utility and SQL inserts the SQL path into the System Path Variable. My problem is that sometimes the version of dtutil is wrong. The client is trying to install a package into SQL 2008 but the path variable is pointing to a 2005 dtutil. I want to check the version of dtutil and verify that it is compatible.

是否可以在不知道路径的情况下在vb.net项目中获取dtutil的版本?

Is there a way that I can get the version of dtutil within my vb.net project without knowing the path?

推荐答案

是否可以在不知道路径的情况下在vb.net项目中获取dtutil的版本?

Is there a way that I can get the version of dtutil within my vb.net project without knowing the path?

可能不是-如果您要搜索实用程序,则不会知道找到的版本是否正在执行.但是您可以使用该命令中的环境变量之一来获取SQL版本, 或者您可以使用PATH环境变量来查找操作系统搜索该文件的位置.参见:
环境 .

Probably not - If you go searching for the utility you won't know whether or not the version you find is the one that is being executed.    But you may be able to get the SQL version using one of the environment variables in that command, or perhaps you can use the PATH environment variable to find the location where the OS searches for that file.   See:
Environment.
GetEnvironmentVariable Method (String)

或者,连接到SQL Server并读取版本号(ServerVersion属性).

Or, connect to the SQL server and read the version number (ServerVersion property).


这篇关于如何在不知道路径的情况下获取可执行文件的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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