Solved

Run Program with Switches

Posted on 2011-09-19
2
320 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
[X]
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
2 Comments
 
LVL 86

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

688 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