Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Execute a command line in VS2012

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Latest thoughts on C# utilizing Mono on Linux vs .NET on Windows? 5 61
How to duplicate form in Visual Studio 2015 2 57
SSIS On fail action 5 37
Easy filter aspnet 2 24
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…
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 …
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

839 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