Solved

Run Program with Switches

Posted on 2011-09-19
2
317 Views
Last Modified: 2013-11-27
Hey.

I'm trying to run my app with switches included but seems to error out. Any help?

Here's my code


'Run App

        Try
            Dim Drive As String = System.IO.Path.GetPathRoot(Application.StartupPath)
            Dim App As String = System.IO.Path.Combine(Drive, "\AppDir\App.exe /Switch1 /Switch2")
            Process.Start(App)
        Catch ex As Exception
            MsgBox("App Failed.", MsgBoxStyle.Exclamation)
        End Try

Open in new window

0
Comment
Question by:Here2Help
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 36563159
Try it this way:
Try
            Dim Drive As String = System.IO.Path.GetPathRoot(Application.StartupPath)
            Dim App As String = System.IO.Path.Combine(Drive, "\AppDir\App.exe")

            Dim P As New Process
            P.StartInfo.FileName = App
            P.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(P.StartInfo.FileName)
            P.StartInfo.Arguments = "/Switch1 /Switch2"
            P.Start()
        Catch ex As Exception
            MsgBox(ex.ToString, "App Failed.", MsgBoxStyle.Exclamation)
        End Try

Open in new window

0
 
LVL 8

Author Comment

by:Here2Help
ID: 36563446
Works a treat.

cheers.
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

778 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