5

we have a .exe file. It takes input as .txt file and gives output as another .txt file.

Now, I want to run that .exe file from MM.

I tried in 2 way,

Case 1 :

using SystemOpen[].

It showing the following Window, Once I run the SystemOpen[path].

enter image description here

I click on Run button.after it's not showing anything.

for my conformation, Manually I double click on .exe file. it's working fine. but SystemOpen[] was not working.

case 2:

I created .bat file with the following code

   cd C:\Users\Infratab Bangalore\Desktop\Rod's
   Infratab1-2.exe

Now I open .bat file using same function SystemOpen[]. here it's working great.

How can I fix case 1 problem. If anybody knows suggest me.

Thanks.

Teake Nutma
  • 5,981
  • 1
  • 25
  • 49
subbu
  • 2,304
  • 1
  • 13
  • 32
  • 3
    The tutorial on running external programs would be a good place to start – Simon Woods Jul 22 '13 at 10:33
  • @SimonWoods I tried with Run and Runthrough in the following way. but not working Run[.exe FilePath] – subbu Jul 22 '13 at 11:19
  • @SimonWoods If I use any functions like, CompilationTarget.it showing A C compiler cannot be found on your system. Please consult the \ documentation to learn how to set up suitable compilers. so Am I need to install C in my system. – subbu Jul 22 '13 at 12:21
  • Thanks for adding some relevant information. That at least looks like a question that one can attempt to answer now, so I have reopened this. – Mr.Wizard Jul 22 '13 at 14:03
  • I imagine this is likely a path issue. – chuy Jul 22 '13 at 17:08
  • I tried opening exe file with SystemOpen[] it was working fine.why dont u try opening some other exe file.Also try changing directory. – Hubble07 Aug 22 '13 at 11:56
  • 1
    Have you tried unchecking the "Always ask before opening" checkbox in that dialog that came up? – Szabolcs Sep 21 '13 at 16:43

1 Answers1

2

I would do the following.

file = OpenWrite[FileNameJoin[{$TemporaryDirectory, "testfile.bat"}]]
WriteString[file, "call path"]

And then use SystemOpen to call the file.

William
  • 7,595
  • 2
  • 22
  • 70
  • 1
    Why do I need to create another files. Already I have Input files,just I need to execute .exe file.Automatically it will take every thing. – subbu Jul 22 '13 at 16:53
  • 1
    @subbu I dont know much about the internals, I was just trying to get it to work. – William Jul 22 '13 at 16:59