?
Solved

Run Program with Switches

Posted on 2011-09-19
2
Medium Priority
?
321 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 500 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

752 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