Starting program from cmd only working on 64bit PCs

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hey everyone,
Im trying to start a program through the command line.
Ive written a small application for this, but it only seems to be working on 64bit computers.
Whenever I try to run this on a 32bit PC, nothing happens at all. I dont even get an error.
Even simply trying to open, for example, notepad doesnt work. So it seems to me that cmd doesnt start to run, at all.
I have also searched numerous sites, but havent find a solution yet.
Heres a part of my code:

<pre class="prettyprint lang-vb" style=" Private Sub StartController()
Dim myprocess As New Process
Dim StartInfo As New System.Diagnostics.ProcessStartInfo
Dim CMDCommand As String = ""
Dim Results As String = ""
Dim StringLength As Integer = 0
Dim SR As System.IO.StreamReader = myprocess.StandardOutput
Dim SW As System.IO.StreamWriter = myprocess.StandardInput

StringLength = (ControllerPath.Length - (ControllerPath.LastIndexOf(""))) - 1
CMDCommand = Chr(34) & JavaPath.Substring(0, JavaPath.Length - 4) & Chr(34) & " -jar " & ControllerPath.Substring(ControllerPath.LastIndexOf("") + 1, StringLength) & " --broker_list mycompany.com --token " & Token & " --session active"
StartInfo.FileName = "cmd" starts cmd window
StartInfo.RedirectStandardInput = True
StartInfo.RedirectStandardOutput = True
StartInfo.UseShellExecute = False required to redirect
StartInfo.CreateNoWindow = True creates no cmd window
myprocess.StartInfo = StartInfo
myprocess.Start()
SW.WriteLine("cd " & ControllerPathLoc)
SW.WriteLine(CMDCommand)
SW.WriteLine("exit")
Results = SR.ReadToEnd returns results of the command window
SW.Close()
SR.Close()
End Sub[/code]
I know there probably are some small mistakes, but its been a long time since I last wrote some code.
Thanks in advance!

<br/>

View the full article
 
Back
Top