Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-09-23
3
Medium Priority
?
358 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 1500 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

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…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

730 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