Solved

Execute a command line in VS2012

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

776 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