Process.Start? [英] Process.Start ?

查看:87
本文介绍了Process.Start?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

H

如果我在安装了SQL服务器的计算机上使用了
Process.Start(DTSRun ...),它就不能fin

DTSRun,声称''找不到文件''。尽管如此,来自VB.NET的
Shell(DTSRun ...)工作正常

它也适用于从命令行运行DTSRun而无需输入目录

为c:\program files \ microsoft sql server \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\它可以找到

VB.NET的Shell的等价物是什么,因为需要依赖Environmen

变量


谢谢

解决方案

嗨Songie,


尽管我们大多数人都知道你的意思听起来像是一个

的测验。


当你想要一个答案,告诉你想要什么时,这不容易吗? />
archieve并将此问题仅发送给C#语言新闻组。


现在来自C#组的人员必须了解它在VB.net中的工作原理。


对于VB.net的人来说,没什么兴趣所有。


只是我的想法,


Cor


songie,


我认为如果DTSRun是可执行文件,那么使用Process

类也可以。但是,如果它是某种类型的包,那么你需要在ProcessStartInfo

类上设置UseShellExecute标志,以指示shell应该运行相关的可执行文件使用

文件(这正是我认为VB中的Shell函数所做的)。


您可以通过添加对<的引用来轻松解决这个问题。 br />
Microsoft.VisualBasic.dll,然后在Microsoft.VisualBasic命名空间中的

Interaction类上调用静态Shell函数。它已经管理了

代码,所以它可以正常工作(并且它随.NET

框架一起发布)。


希望这会有所帮助。


-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" songie D" <一个******* @ discussions.microsoft.com>在消息中写道

news:36 ********************************** @ microsof t.com ...


如果我在安装了SQL服务器的计算机上使用了
Process.Start(" DTSRun ..."),
它找不到DTSRun,声称''找不到文件''。尽管如此,来自VB.NET的Shell(DTSRun ...)工作正常。
它也适用于从命令行运行DTSRun而无需键入
目录,如c:\program files\microsoft sql server \\\tools \ binn在''path''
环境变量中,所以可以找到它。
什么是等效的VB.NET的Shell的C#,是否需要依赖
环境变量?

谢谢



< blockquote>这不是一个测验,只有一个问题。

我发布到VB.NET新闻组,因为我希望

来抓住那些用过的人无论是VB.NET还是C# - 我总是

使用C#,不喜欢VB.NET,但是我的同事们刚刚使用VB.NET启动了一个项目



" Cor Ligthert" <无********** @ planet.nl>在留言中写道

news:ee **************** @ TK2MSFTNGP12.phx.gbl ...

Hi Songie,

尽管我们大多数人可能都知道你的意思,这听起来像是一个
测验。

当你想要一个答案时,这不容易吗?告诉你想要什么,并将此问题仅发送给C#语言新闻组。

现在,来自C#组的人们必须了解它在VB.net中是如何工作的。
只是我的想法,

Cor



H
If I us
Process.Start("DTSRun ...") on a computer that has SQL server installed, it can''t fin
DTSRun, claiming ''file not found''. Despite this,
Shell("DTSRun...") from VB.NET works fine
It also works to run DTSRun from the command line without typing in the directory
as c:\program files\microsoft sql server\80\tools\binn is in the ''path'' environmen
variable, so it can be found
What is the equivalent in C# of VB.NET''s Shell, given that the reliance on Environmen
variables is desired

Thanks

解决方案

Hi Songie,

Despite that most of us probably know what you mean does it sound like a
quiz.

Is it not more easy, when you want an answer, to tell what you want to
archieve and send this question only to the C# language newsgroup.

Now the people from the C# group have to find out how it works in VB.net.

And for the VB.net people it is of no interest at all.

Just my thought,

Cor


songie,

I would think that if DTSRun is an executable, then using the Process
class would work just as well. However, if it is a package of some kind,
then you would have to set the UseShellExecute flag on the ProcessStartInfo
class to indicate that the shell should run the executable associated with
the file (which is exactly what I think the Shell function in VB does).

You can easily get around this by adding a reference to
Microsoft.VisualBasic.dll, and then calling the static Shell function on the
Interaction class in the Microsoft.VisualBasic namespace. It''s managed
code, so it will work just fine (and it is distributed with the .NET
framework).

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"songie D" <an*******@discussions.microsoft.com> wrote in message
news:36**********************************@microsof t.com...

Hi
If I use
Process.Start("DTSRun ...") on a computer that has SQL server installed, it can''t find DTSRun, claiming ''file not found''. Despite this,
Shell("DTSRun...") from VB.NET works fine.
It also works to run DTSRun from the command line without typing in the directory, as c:\program files\microsoft sql server\80\tools\binn is in the ''path'' environment variable, so it can be found.
What is the equivalent in C# of VB.NET''s Shell, given that the reliance on Environment variables is desired?

Thanks



It''s not a quiz, there was only one question.
I cross posted to the VB.NET newsgroup as I was hoping
to catch people that used both VB.NET and C# - I always
use C#, don''t like VB.NET, but my colleagues have just
started a project using VB.NET.

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:ee****************@TK2MSFTNGP12.phx.gbl...

Hi Songie,

Despite that most of us probably know what you mean does it sound like a
quiz.

Is it not more easy, when you want an answer, to tell what you want to
archieve and send this question only to the C# language newsgroup.

Now the people from the C# group have to find out how it works in VB.net.

And for the VB.net people it is of no interest at all.

Just my thought,

Cor



这篇关于Process.Start?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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