How to open a command prompt using c# coding?

G

Guest

Hi,
I know that we can open Visual studio command prompt from start menu. But i
have been assigned a task in which i have to do that in coding. So that when
i run the c# program, the visual studio command prompt should open. I have
seen a syntax for opening the windows command prompt.That Goes like this

process.start("cmd.exe");

But dont know how to open the visual studio command prompt. Can anyone help
me out.

Regards
Priya.
 
D

donna.gravell

The VS command prompt is just a bat file that sets a few environment
variables (look at the Start Menu shortcut for the path). You could
either simply use Process.Start to invoke the existing bat file, or
look at the existing file to see what environment variables you need,
and set them directly. For simplicity, the former is quicker and
easier. But of course this will only work on a developer PC.

Marc
 
M

Marc Gravell

;-p

Nah, in truth I simply forgot that my other half had been using my
main desktop while I was at TechEd... made me chuckle, though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top