Solved

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

Posted on 2014-09-23
3
313 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

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

Suggested Solutions

Title # Comments Views Activity
Trying to Create FTP Client in VB.net - getting errors 3 38
.NET Redemption/Outlook Examples 3 35
Adding Rows to Grid 4 34
Datagriview cell not show all data 4 13
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

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