I'm trying to code something in Visual Basic, more specifically Visual Studio 2010. I want, with a button click, my program to execute a command. Is that possible?
相关问题
- 'System.Threading.ThreadAbortException' in
- Visual Studio 2010 randomly says the command line
- how to use special characters like '<'
- (ASP.NET) Project file must include 'WindowsBa
- Partial Form Class C# - Only display code view for
相关文章
- vb.net 关于xps文件操作问题
- How to show location of errors, references to memb
- Log4Net Multiple Projects
- Compiling error in C++ project with C and C++ code
- How to use Mercurial from Visual Studio 2010?
- Checking for DBNull throws a StrongTypingException
- Using the typical get set properties in C#… with p
- VSIX: execute code on VS startup
You need to use CreateProcess [ http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx ]
For ex:
LPTSTR szCmdline[] = _tcsdup(TEXT("\"C:\Program Files\MyApp\" -L -S")); CreateProcess(NULL, szCmdline, /.../);
Or, you could do it the really simple way.
Yes. You can use
Process.Start
to launch an executable, including a console application.If you need to read the output from the application, you may need to read from it's StandardOutput stream in order to get anything printed from the application you launch.
Here is an example:
And here is a extended function: (Notice the comment-lines using CMD commands.)