I was wondering if there is an elegant solution to building command lines to launch against an exe, when you potentially have hundreds of parameters.
I guess the most obvious way would be to use if/else statements and build a giant string, but it doesn't feel particularly elegant. Has anyone already solved this problem before?
To Clarify
Say I was writing a program that launched the program notepad.exe, which itself was configurable by accepting command line parameters.
My programs sole purpose is to build the commandline and launch the application.
So I would have a form which had every option that I could set within Notepad.
Radiobutton for WordWrap yes/no. Combobox for Font Inputbox for FontSize.
When I click the "Launch" button I would run "notepad.exe -wordwrap yes -font tahoma -size 8".
So my question is as follows:
- How would you handle the form logic for building the commandline, would you have a class full of properties for each parameter? And have a Build() method which assembled them all?
- How would you pass the parameters to the executable?
I'm looking for an elegant solution, not something like:
if (chkWordWrap == true)
commandline.add("-wordwrap true")
I hope that clarifies what I'm asking :)