Solved

Execute a command line in VS2012

Posted on 2013-06-13
2
377 Views
Last Modified: 2013-07-05
Greeting,

I have the following command in bat and I would like to know how to execute the same command in Visual Studio app.

cd %ProgramFiles(X86)%\xxxxxxxxx\bin
zac unr -u MyUserName -p MyPassword
pause
exit
0
Comment
Question by:mrong
2 Comments
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 500 total points
ID: 39246254
using( Process process = new Process() )
{
    ProcessStartInfo startInfo = new ProcessStartInfo();
    startInfo.UseShellExecute = false;
    startInfo.RedirectStandardError = true;
    startInfo.FileName = "C:\\Program Files (x86)\\bin\\zac";
    startInfo.Arguments = "-u MyUserName -p MyPassword";

    process.EnableRaisingEvents = false;
    process.StartInfo = startInfo;

    process.Start();
}

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 39247140
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Not showing page correctly 3 29
Error on Add method 1 37
Allow User To Arrange Columns At Datagridview 3 19
Help with AsEnumerable(), LINQ 4 22
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now