Solved

Visual Basic 2010 Shell command to change foler and run command in the folder

Posted on 2010-11-27
4
1,167 Views
Last Modified: 2013-11-26
Hi
I am writting a small program in Visual Basic studio 2010, I would like to shell to a command prompt change the working directory then run a command still within the working directory, can anyone tell me how this can be achieved
0
Comment
Question by:sykotex
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 34222050
Are you talking about a Console application, that can interact with the Console?  Or, are you talking about using System.Diagnostics.Process?
0
 
LVL 1

Author Comment

by:sykotex
ID: 34222069
I'm a begginer so I may not be to clear. I have a program which runs from a command line. I am writting a windows form front end that will ulimatley run this program with its switches at the end. The switches for the command line program use file paths which don't appear to work if a full path is entered
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 34222625
If you have a Windows Forms application, and you need to start an external process, you can use the System.Diagnostics.Process class, like in this example:

Process Class (System.Diagnostics)

Dim myProcess As New Process()

            Try                ' Get the path that stores user documents.

                myProcess.StartInfo.UseShellExecute = False
                ' You can start any process, HelloWorld is a do-nothing example.
                myProcess.StartInfo.FileName = "C:\\HelloWorld.exe"
                myProcess.StartInfo.CreateNoWindow = True
                myProcess.Start()
                ' This code assumes the process you are starting will terminate itself. 
                ' Given that is is started without a window so you cannot terminate it 
                ' on the desktop, it must terminate itself or you can do it programmatically
                ' from this application using the Kill method.

Open in new window

0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 34222914
please go through the following link, it clearly tells how to add console in a windows form:-

http://stackoverflow.com/questions/252323/how-do-i-add-a-console-like-element-to-a-c-winforms-program
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
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…

762 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

24 Experts available now in Live!

Get 1:1 Help Now