propellent.exe result pipe error message when called from VB
wes_retired
Posts: 3
I am calling propellent.exe from VB.net, using the Process.Start (file, arg) form. The arg is a string with the entire argument set for propellent, while file is propellent.exe itself. The arg string looks like this:
(quotes make this a string in VB)
" /GUI ON /EEPROM 20a02.0sd.binary > result.txt"
Propellent launches and immediately throws up a message box that there are to many files. If the > result.txt is removed from the string all is good and the customary message boxes displaying the various programming steps are displayed.
If I run propellnet from a cmd window and the command line the > results.txt pipe works fine.
Anybody know what gives?
Thanks,
Wes.
Comments
@"Jeff Martin" is probably the guy with answers.
Your problem is that you're starting the process with the literal arguments
/GUI ON /EEPROM 20a02.0sd.binary > result.txt
, so it presumably tries to treat ">" and "result.txt" as source files. Output redirection is a feature of the shell (cmd.exe), not of the OS itself.The correct solution is to capture the command output and write it to a file yourself (IDK how to do that in VB).
The lazy terrible solution is to run cmd.exe and give it the command to execute:
/c "propellent /GUI ON /EEPROM 20a02.0sd.binary > result.txt"
(note that you need to escape the quotes within the string somehow. Again, little offhand VB knowledge)Wuerfel_21 et al:
Thanks for the responses. I did solve my problem, and the solution is along the lines of what you said.
The thing I missed is that the command line arguments for the path and file names for both the eeprom file and the pipe file must be either:
1. not containing any spaces (not something you want to enforce nowadays)
2. or contained within quotes.
So for example suppose the eeprom file is at c:\firmware pmc8\try.eeprom, and if the pipe file was to go to the same place as c:\firmware pmc8\result.txt. The shell command in VB requires all the arguments to be strings, so all variables are either explicitly quoted strings of characters, or variables dimensioned as strings. What is needed is to include in the variable names embedded quotes or pre and post append chr(34) to the variables.
Works fine. I think everyone knew this but me. :>)
Thanks.
Wes.