473,387 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Process.Start ?

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
Nov 20 '05 #1
15 2070
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
Nov 20 '05 #2
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

Nov 20 '05 #3
* "=?Utf-8?B?c29uZ2llIEQ=?=" <an*******@discussions.microsoft.com> scripsit:
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?


\\\
Dim psi As New ProcessStartInfo()
psi.FileName = "DTSRun.exe"
psi.Arguments = ...
Process.Start(psi)
///

.... should work.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
> > What is the equivalent in C# of VB.NET's Shell, given that the reliance
on Environment
variables is desired?


\\\
Dim psi As New ProcessStartInfo()
psi.FileName = "DTSRun.exe"
psi.Arguments = ...
Process.Start(psi)
///

... should work.

In C#, I do not believe that.

Was a busy day I gues

:-))

Cor
Nov 20 '05 #5
* "Cor Ligthert" <no**********@planet.nl> scripsit:
What is the equivalent in C# of VB.NET's Shell, given that the reliance on Environment variables is desired?


\\\
Dim psi As New ProcessStartInfo()
psi.FileName = "DTSRun.exe"
psi.Arguments = ...
Process.Start(psi)
///

... should work.

In C#, I do not believe that.

Was a busy day I gues


A little bit Java "programming" for university...

This is a VB.NET group. If the OP wants a solution in C#, he should
post to the C# group only.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
This is a VB.NET group. If the OP wants a solution in C#, he should
post to the C# group only.


That was what I told in the first answer you see in this thread

however after all that Java I understand, but Weener melange is very good I
thought

:-))

Cor
Nov 20 '05 #7
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

Nov 20 '05 #8
> ...if DTSRun is an executable,

Yes, it is. It's installed as part of SQL server client tools
and is in the associated 'bin' directory, which is listed in the
'path' environment variable.
I would think that ... then using the Process
class would work just as well.
Unfortunately, it doesn't. Try it - create a new folder, and put
a simple batch file in it, say. Then add it to the 'path' environment
variable, then when you restart check that you can call it from
a DOS prompt when it isn't the current directory. Then try
comparing calling it from Shell in VB.NET, against using
Process.Start from C#. I'd be interested to hear what you make of it...
However, if it is a package of some kind,
Nah... it's not. It's an exe.
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).
So... does that mean that C# can just delve into VB.NET and steal its
functions whenever it wants?! Great news, but a little confusing....the main
source of confusion being why doesn't C# have its own equivalent, does
VB.NET have any other functions than C# doesn't, and if so, doesn't that
make it a more powerful language?

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


Nov 20 '05 #9
songie D <so****@d.com> wrote:
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).


So... does that mean that C# can just delve into VB.NET and steal its
functions whenever it wants?! Great news, but a little confusing....the main
source of confusion being why doesn't C# have its own equivalent, does
VB.NET have any other functions than C# doesn't, and if so, doesn't that
make it a more powerful language?


C# as a *language* doesn't have any functions. However, it can use the
same types that VB.NET uses to emulate old VB behaviour. Unfortunately,
the Microsoft.VisualBasic assembly isn't documented, and to my mind
isn't really intended to be used other than by the VB.NET compiler.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 20 '05 #10
Hi Jon,

Something for this page maybe?

http://www.pobox.com/~skeet/csharp/faq/#vb.or.csharp

C# as a *language* doesn't have any functions. However, it can use the
same types that VB.NET uses to emulate old VB behaviour. Unfortunately,
the Microsoft.VisualBasic assembly isn't documented, and to my mind
isn't really intended to be used other than by the VB.NET compiler.


:-) only to prickle

However what do you mean by the Microsoft.VisualBasic assembly isn't
documented, how should I see that comparing that with C#?

Cor
Nov 20 '05 #11
Cor Ligthert <no**********@planet.nl> wrote:
Something for this page maybe?

http://www.pobox.com/~skeet/csharp/faq/#vb.or.csharp


Possibly...
C# as a *language* doesn't have any functions. However, it can use the
same types that VB.NET uses to emulate old VB behaviour. Unfortunately,
the Microsoft.VisualBasic assembly isn't documented, and to my mind
isn't really intended to be used other than by the VB.NET compiler.


:-) only to prickle

However what do you mean by the Microsoft.VisualBasic assembly isn't
documented, how should I see that comparing that with C#?


There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.

C# doesn't have documentation for built-in functions because it doesn't
*have* any built-in functions. The nearest it has are the language
constructs of lock, using and foreach, all of which are clearly
documented in terms of their more wordy equivalents.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 20 '05 #12
Jon,
With all due respect: Huh??? ;-)
There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.
Start here:

http://msdn.microsoft.com/library/de...ppActivate.asp

As you say the functions are documented, included at the bottom of this
documentation is the Namespace, Module (remember a module is nothing more
then a class with static methods only) and Assembly of where the function
is.

Unless of course you are referring to Keywords, such as CInt, then although
they are listed as Functions, they are not actual functions... (they do
however call undocumented helper functions in the above assembly).

Hope this helps
Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Cor Ligthert <no**********@planet.nl> wrote:
Something for this page maybe?

http://www.pobox.com/~skeet/csharp/faq/#vb.or.csharp


Possibly...
C# as a *language* doesn't have any functions. However, it can use the
same types that VB.NET uses to emulate old VB behaviour. Unfortunately, the Microsoft.VisualBasic assembly isn't documented, and to my mind
isn't really intended to be used other than by the VB.NET compiler.


:-) only to prickle

However what do you mean by the Microsoft.VisualBasic assembly isn't
documented, how should I see that comparing that with C#?


There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.

C# doesn't have documentation for built-in functions because it doesn't
*have* any built-in functions. The nearest it has are the language
constructs of lock, using and foreach, all of which are clearly
documented in terms of their more wordy equivalents.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 20 '05 #13
Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote:
With all due respect: Huh??? ;-)
There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.


Start here:

http://msdn.microsoft.com/library/de...y/en-us/vblr7/
html/vastmAppActivate.asp

As you say the functions are documented, included at the bottom of this
documentation is the Namespace, Module (remember a module is nothing more
then a class with static methods only) and Assembly of where the function
is.


Ah, that's good to see. Shame it only comes up if you've got a filter
that includes Visual Basic though - why would that be the case if the
assembly were designed to be used from other languages? (That's almost
certainly why I haven't seen it before. I tend to have a Visual C#
filter on.)

It's certainly *not* part of the main framework like (say)
System.IO.Stream is - hence why even within MSDN it's not under the
".NET Framework/Reference/Class Library" topic.

So while I accept that it's documented (and am pleased by that) I still
don't think it's something C# programmers should be referencing without
a very good reason.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 20 '05 #14
Jon,
So while I accept that it's documented (and am pleased by that) I still
don't think it's something C# programmers should be referencing without
a very good reason. Totally agree!!
It's certainly *not* part of the main framework like (say)
System.IO.Stream is - hence why even within MSDN it's not under the
".NET Framework/Reference/Class Library" topic. It is however shipped with the framework! I think Ed has the right idea, if
you are porting/upgrading something use it at first, then refactor it out,
unless there is a very good reason...

Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote:
With all due respect: Huh??? ;-)
There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.


Start here:

http://msdn.microsoft.com/library/de...y/en-us/vblr7/
html/vastmAppActivate.asp

As you say the functions are documented, included at the bottom of this
documentation is the Namespace, Module (remember a module is nothing more then a class with static methods only) and Assembly of where the function is.


Ah, that's good to see. Shame it only comes up if you've got a filter
that includes Visual Basic though - why would that be the case if the
assembly were designed to be used from other languages? (That's almost
certainly why I haven't seen it before. I tend to have a Visual C#
filter on.)

It's certainly *not* part of the main framework like (say)
System.IO.Stream is - hence why even within MSDN it's not under the
".NET Framework/Reference/Class Library" topic.

So while I accept that it's documented (and am pleased by that) I still
don't think it's something C# programmers should be referencing without
a very good reason.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 20 '05 #15
Jon,
So while I accept that it's documented (and am pleased by that) I still
don't think it's something C# programmers should be referencing without
a very good reason. Totally agree!!
It's certainly *not* part of the main framework like (say)
System.IO.Stream is - hence why even within MSDN it's not under the
".NET Framework/Reference/Class Library" topic. It is however shipped with the framework! I think Ed has the right idea, if
you are porting/upgrading something use it at first, then refactor it out,
unless there is a very good reason...

Jay
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om... Jay B. Harlow [MVP - Outlook] <Ja************@msn.com> wrote:
With all due respect: Huh??? ;-)
There is no documentation for the Microsoft.VisualBasic assembly, as
far as I've seen. There's documentation for VB.NET's built-in
functions, but that doesn't document how they convert to IL calls.


Start here:

http://msdn.microsoft.com/library/de...y/en-us/vblr7/
html/vastmAppActivate.asp

As you say the functions are documented, included at the bottom of this
documentation is the Namespace, Module (remember a module is nothing more then a class with static methods only) and Assembly of where the function is.


Ah, that's good to see. Shame it only comes up if you've got a filter
that includes Visual Basic though - why would that be the case if the
assembly were designed to be used from other languages? (That's almost
certainly why I haven't seen it before. I tend to have a Visual C#
filter on.)

It's certainly *not* part of the main framework like (say)
System.IO.Stream is - hence why even within MSDN it's not under the
".NET Framework/Reference/Class Library" topic.

So while I accept that it's documented (and am pleased by that) I still
don't think it's something C# programmers should be referencing without
a very good reason.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 20 '05 #16

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
6
by: Dmitri Shvetsov | last post by:
Hi, Can I start an external process from the Web Service? I'm using a code, compiler keeps silence, compiles ok and starts the project. When I trace in Debugger it doesn't start an external...
4
by: Yiu | last post by:
upgent help i want to start IE explorer using C# i try many code such as below: ProcessStartInfo startInfo = new ProcessStartInfo("IEXPLORE.EXE"); Process.Start(startInfo); or Process...
10
by: Sorin Dolha [MCSD .NET] | last post by:
I would like to start a process from C# code as another user. The C# code is executed as the ASPNET user because it relies in a Web Page class, and I would like that the process will run as another...
12
by: Raymond Lewallen | last post by:
How to wait for a process to stop completion is my goal. Obviously, the looping while waiting for the HasExited property is not a solution.. but thats the best I can come up off the top of my...
0
by: henning.friese | last post by:
Hello NG, I'm need to write some code which creates tiff files from various document types (doc, pdf, xls). I want to do this by ShellExecuting (via System.Diagnostics.Process) the doc-files...
3
by: BuddyWork | last post by:
Hello, Could someone please explain why the Socket.Send is slow to send to the same process it sending from. Eg. Process1 calls Socket.Send which sends to the same IP address and port, the...
0
by: Buddy Home | last post by:
There is two examples of code. Example 1. Send and Receive within the same process. Put this code in a console app called SendAndReceive and run the code. using System; using...
0
by: =?Utf-8?B?Um9i?= | last post by:
I've a requirement to monitor when certain applications are started. I'm using WMI called from VS Stusio 2005 in VB to trap Excel and Word starting. I've written the following console application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.