Solved

Execute a command line in VS2012

Posted on 2013-06-13
2
373 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

760 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