Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6651927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:04:12+00:00 2026-05-26T01:04:12+00:00

I have a executable that when double clicked opens in a command line window.

  • 0

I have a executable that when double clicked opens in a command line window.enter image description here

Now there is a input file (i.e named “sphere_15000.inp”) in the same directory where the executable apame_win64.exe is located. So we can inter the file name in the command line.
enter image description here

The question is how this can be done from mathematica front end? With the RunThrough command I tried to do it with no avail.

RunThrough["Executable Location", "sphere_15000"]

Do I need to put this file location in my Windows 7 environment path variable? Hope for some suggestion in this regard.

UPDATE

Found a solution to my problem.

  1. First set the Mathematica directory to the folder where the executable is located.

    path=”C:\Users\FlowCrusher\Desktop\CUSP solver\Apame_build_2011_01_09\solver”;
    SetDirectory[path];

  2. Then use the following style of input.

    Run[“\”\”apame_win64.exe\” \”input\”\””]

Here “apame_win64.exe” is the executable one want to run and “input” is the input file for the executable. This solves the problem. But a new item in the wishlist.

Is there a way to hide the console window in the background?

Here is how it looks on my screen.
enter image description here

As Chris suggested if we use minimized console in the Run command we get a minimized window but the program does not execute.

enter image description here

I hope that a solution exists.

BR

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:04:12+00:00Added an answer on May 26, 2026 at 1:04 am

    Yes, you might put the folder of you executable into the Path variable, or provide the full path name.

    However, RunThrough seems to have been superseeded (on Windows) by
    Import[“!command “,”Text”], which will execute command and read the comaand line output into Matheamtica as a string.
    E.g.:

    Export["testit.txt", "bla", "Text"];
    Import["!dir" <> " testit* > dir.log", "Text"];
    FilePrint["dir.log"]
    

    —

    Otherwise, I also had good results in the past using NETLink (not sure if WScript.shell
    still works on Windows7/8 or if one should use something else).
    Emulating Run (RunThrough is not really needed I think):

    Run2[cmd_String] := Module[{shell},
        Switch[$OperatingSystem,
            "Windows",
                Needs["NETLink`"];
                shell = NETLink`CreateCOMObject["WScript.shell"];
                shell @ run[cmd,0,True],
            "Unix",
                Run @ cmd, 
            "MacOSX",
                Run @ cmd ] ];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a command line executable that alters some bits in a file that
I have an executable that depending on the command line switch supplied looks something
I have an executable that accepts certain command line arguments. Any user on the
I have an executable that I need to take input from a .wav file
I want to have an executable file that will call some other programs. The
I have a portable executable that saves data to a file in the same
I have created an executable Java .jar file. That is to say, I properly
I have an executable that is started by a windows service, this program will
I have an executable that defaults to 32-bit. It doesn't have source code and
I have a setup executable that I need to install. When I run it,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.