Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-09-23
3
Medium Priority
?
386 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
  • 2
3 Comments
 
LVL 35

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 35

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

772 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