Solved

Run process on 64-bit server using System.Diagnostics.ProcessStartInfo not working

Posted on 2014-09-23
3
334 Views
Last Modified: 2015-03-10
I need to run an executable which happens to reside on a 64-bit OS. I am attempting to start the process via the ProcessStartInfo function while passing it the path of the executable, and necessary arguments. This is not working. Has anyone successfully done this?

I've tried
Dim FILENAME As String = ""
        FILENAME = "D://wwwroot//[filename]"
       
        Dim path As String = "////[path_location]"
       
        Try

            Dim myProcessStartInfo As New System.Diagnostics.ProcessStartInfo("[program.exe]")
            myProcessStartInfo.Arguments = String.Concat(FILENAME, " """, path, """ [args]")
            System.Diagnostics.Process.Start(myProcessStartInfo)
       

Open in new window

and below code where I pass the command and arguments
Dim p As Process = New Process()
           Dim pi As ProcessStartInfo = New ProcessStartInfo()
            pi.Arguments = command + " " + arguments
            pi.FileName = "cmd.exe"
           

            p.StartInfo = pi
            p.Start()

Open in new window

0
Comment
Question by:tammieR
[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
3 Comments
 
LVL 34

Expert Comment

by:it_saige
ID: 40339895
What exception do you receive?

-saige-
0
 

Author Comment

by:tammieR
ID: 40341896
no exception. The executable runs as a service and closes without working correctly. I'm wondering if I'm not passing arguments correctly. My hang up seems to be the direction of the slash for the path locations, and how to many to use. I've tried both C:\ and C://, for example. Which is the correct method?
0
 
LVL 34

Accepted Solution

by:
it_saige earned 500 total points
ID: 40341957
Strictly speaking, VB.NET does not care so much about the forward or the backslash.  C# on the other hand does as the backslash is an escape character.  The file system on the other hand does.  If you are dealing with a Microsoft operating system (which you most likely are), then the path needs to be formatted with backslashes, i.e. - "D:\inetpub\wwwroot\"; etc.

If you were programming this in C#, you would either double up your backslashes or specify an @ symbol in the front of the string (the @ symbol would define the string as a string literal), i.e. - "D:\\inetpub\\wwwroot\\"; or @"D:\inetpub\wwwroot\"; etc.  Since you are using VB.NET "D:\inetpub\wwwroot\" should suffice.

Now concern question, is the executable that you are attempting to run a 'true' service (in that it is registered with the operating system as a service and appears in the services list)?

If this is the case, then you are probably looking to start it using the ServiceController class:

http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller(v=vs.110).aspx

-saige-
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

635 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