W
WALDO
I wrote a console application that basically consumes arguments and starts
other command line apps via System.Process. Let's call it XCompile for now.
I wrote a Visual basic add-in that does pretty much the same thing to
XCompile. Let's call it MyAddin.
XCompile collects information to send to vbc.exe. When it comes across any
arguments that are file paths, it wraps them in quotes. For example:
[VB.Net psuedocode (from XCompile)]
Dim prms As String
Dim fil As String
Dim files() As String = New String() {"c:\Documents and Settings\...\file
with spaces.vb", "temp\NoSpaces.vb"}
For Each fil In files
prms &= " "
prms &= """"c
prms &= fil
prms &= """"c
Next
Console.WriteLine("vbc.exe " & Trim(prms))
Dim si As New ProcessStartInfo("vbc.exe", Trim(prms))
si.UseShellExecute = False
si.CreateNoWindow = True
si.RedirectStandardOutput = True
si.RedirectStandardErr = True
Dim prc As Process = Process.Start(si)
....
This works well. The problem I come across is when I try to use a Process
against XCompile in the same fashion. vbvc pretends that all the quotes have
disappeared and treats everything with a space in it as a separate argument.
[VB.Net psuedocode (from MyAddin)]
Dim si As New ProcessStartInfo("XCompile.exe", Trim(prms))
si.UseShellExecute = False
si.CreateNoWindow = True
si.RedirectStandardOutput = True
si.RedirectStandardErr = True
Dim prc As Process = Process.Start(si)
....
[Output from XCompile]
vbc.exe "c:\Documents and Settings\...\file with spaces.vb"
"temp\NoSpaces.vb"
vbc : Command line error BC2001 : file 'and' could not be found
vbc : Command line error BC2001 : file 'Settings\waldo\My' could not be
found
....
vbc : Command line error BC2008 : no input sources specified
So in summary, XCompile works, shelling to vbc by itself, but doesn't work
when MyAddin shells to XCompile.
Any Ideas why this happens/how to fix it?
Thanks in advance.
WALDO
other command line apps via System.Process. Let's call it XCompile for now.
I wrote a Visual basic add-in that does pretty much the same thing to
XCompile. Let's call it MyAddin.
XCompile collects information to send to vbc.exe. When it comes across any
arguments that are file paths, it wraps them in quotes. For example:
[VB.Net psuedocode (from XCompile)]
Dim prms As String
Dim fil As String
Dim files() As String = New String() {"c:\Documents and Settings\...\file
with spaces.vb", "temp\NoSpaces.vb"}
For Each fil In files
prms &= " "
prms &= """"c
prms &= fil
prms &= """"c
Next
Console.WriteLine("vbc.exe " & Trim(prms))
Dim si As New ProcessStartInfo("vbc.exe", Trim(prms))
si.UseShellExecute = False
si.CreateNoWindow = True
si.RedirectStandardOutput = True
si.RedirectStandardErr = True
Dim prc As Process = Process.Start(si)
....
This works well. The problem I come across is when I try to use a Process
against XCompile in the same fashion. vbvc pretends that all the quotes have
disappeared and treats everything with a space in it as a separate argument.
[VB.Net psuedocode (from MyAddin)]
Dim si As New ProcessStartInfo("XCompile.exe", Trim(prms))
si.UseShellExecute = False
si.CreateNoWindow = True
si.RedirectStandardOutput = True
si.RedirectStandardErr = True
Dim prc As Process = Process.Start(si)
....
[Output from XCompile]
vbc.exe "c:\Documents and Settings\...\file with spaces.vb"
"temp\NoSpaces.vb"
vbc : Command line error BC2001 : file 'and' could not be found
vbc : Command line error BC2001 : file 'Settings\waldo\My' could not be
found
....
vbc : Command line error BC2008 : no input sources specified
So in summary, XCompile works, shelling to vbc by itself, but doesn't work
when MyAddin shells to XCompile.
Any Ideas why this happens/how to fix it?
Thanks in advance.
WALDO