Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Convert command line to windows

  1. Aug 24, 2013 #1
    Is anybody interested in having a software for converting command line applications to graphical/windows versions? For example you have old program which can be launch only from command line. After converting it, you will get window with parameters to fill in, files to choose and buttons to run command. No more need for running command line (CMD).

    I'm not sure I should start this project, so I'm asking you
  2. jcsd
  3. Aug 24, 2013 #2
    So that software can convert any command line application automatically? I don't think that's possible. Can you give an example?
  4. Aug 24, 2013 #3
    Of course automatically is not possible.

    In this Converter user will create list of arguments. For example argument "File to read matrix from" which will be FILE type. Another argument will be "Reduction factor" with type NUMBER and attached to command switch "-r". After user will create such list of arguments, he will get application with one window. On top he can find "File to read matrix from" area with OpenFile button (file selector). Below text area labeled "Reduction factor" will take number. At the very bottom most important button "Run" will execute application (using command line application in the background).

    No need for hire programmer and no need to run command line and look for file paths, command help, etc.
  5. Aug 24, 2013 #4


    User Avatar
    Gold Member

    What you seem to be describing is just converting a command line application to a GUI based one?

    That isn't that much of a challenge if you are using an IDE like visual studio since you can create the GUI drap and drop style. Then to convert the command line app all you need to do is create wrapper functions to call from your GUI objects. Doesn't take that long depending on how well coded the command line app is.
  6. Aug 24, 2013 #5
    Yes Trollcast. But not everybody has visual studio, and not everybody can use it without learning programming.

    This converter I want to create will be useful for people who want create Window application wrapper around command line application. Easily :)
  7. Aug 24, 2013 #6


    User Avatar
    Gold Member

    I can't see how you'll get round not needing to program unless all the applications it deals with run with something like
    Code (Text):
    $ applicationname arg1 arg2 ...
    and does not need any input after that point. Once it needs input during run time it'll get complicated as every application you go to deal with will be different so it would need to be coded uniquely.

    As for the initial case I meantionned, that shouldn't be too hard to do.
  8. Aug 24, 2013 #7
    Sometimes, especially scientists, have some small command line application, some small tool which invokes like this:
    Code (Text):
     calculate_result -q 1013 file1.txt file2.out
    And they need to go to directory with this program, "cd ....." where are my files... what was the "-q"...

    What you are describing is command line application which interacts with user. Most applications don't do it. But in case I need to handle this scenario I can:
    1. wait 1s if command is finished
    2. if not, show user last few lines of command
    3. if there is something like "please type [y] to confirm" I will leave user option to interact with this application. But the most important is that user will not need to run CMD line any more.

    What do you think about this?
  9. Aug 24, 2013 #8


    User Avatar
    Gold Member

    That definitely sounds plausible, depends on how its implemented on whether it works or not.

    I haven't used windows for programming in a while (well since my last programming class) so I'm a bit rusty on how visual studio and that sort of stuff works but for getting that top example to work you're looking at having a windows form thats going to open file browser dialogs (name?) where the user can select the location of the application and then a textbox for any flags and then use file dialogs to gather up any file arguments that are to be used. As the user works through the form keep adding the arguments / flags to a string then use whatever module to execute that string as a command.
  10. Aug 24, 2013 #9


    User Avatar
    Science Advisor

    I'd recommend you use profiles based on grammars that define the structure of the command line arguments.

    As a more advanced feature, you should run the application with no arguments and if it returns some information about the arguments, you could take that and process it later.

    Once you take the grammatical form of the argument list, you can use this to build a general GUI front-end that matches the grammar so that you can fill in the arguments.

    Finally, I'd suggest you have a feature to import and export arguments using something like XML so that you can save stuff in the GUI to files and load the file to fill in the GUI boxes.
  11. Sep 2, 2013 #10


    User Avatar
    Gold Member

    I have written programs that provide GUI for command-line programs in the past. Be aware, though, that you'll run into difficulty (on Windows) when trying to test whether the command-line operation has completed or not. I've never found a good solution to that problem. People sometimes use files as semaphores, but it's common to run into file locking problems doing that.
  12. Sep 3, 2013 #11
    Thanks Harborsparrow, i will remember that. I'm implementing interface now. I think first working version will be ready in two weeks.
  13. Oct 12, 2013 #12
    First version release

    Hi guys. I've first version of that app. It is called Windows Converter and you can find it here:

    Let me know if you have any suggestions. The biggest features not implemented yet are:
    1. live terminal for interactive console applications (like ncruses)
    2. Default value for command parameters ( like mycommand.exe --param=ALWAYS_ON )
    3. Subcommands (like: git show XXX, git log YYY )

    That was easy part. Now hard period of finding users...
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook