Click here to Skip to main content
15,920,704 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
I am trying to run an .exe that is a windows app written in Smalltalk.

It is located at "C:\Program Files (x86)\AppFolder\app.exe"

I want to open the app (in same way as how it works when you double click on app.exe).

When I execute the following it does not actually start the app. I see part of the splash screen but then the app does not open. I see that a process has started but I do not see the app screen...

Process.Start(@"C:\Program Files (x86)\AppFolder\app.exe");

Note, I can run a .bat file with the following and this does work from c#..

cd "C:\Program Files (x86)\AppFolder"

Why does this not work and how do I get the c# program to execute the .exe as if it called from the folder?

Thanks in advance
Sergey Alexandrovich Kryukov 12-Nov-15 15:15pm    
Not clear. What does work and what not? And, most importantly, remember that we have no idea what this file is. This program can be written in such a stupid way that it is sensitive to the working directory.
ukjohnct 12-Nov-15 17:20pm    
Thanks SA.

Seems strange to me that I have to set the current directory when I have entered a fully qualified path name but this did fix it.

Sergey Alexandrovich Kryukov 12-Nov-15 20:51pm    
You are very welcome. Next time, to address to anyone, you have to comment on one's post, otherwise that person won't get a notification. I didn't. You could comment on the answer post, another comment ("Reply"), etc.
Good luck, call again.

1 solution

These two ways are not equivalent.

To mimic your batch behavior, first change the current directory:[^].

Of course, correctly written applications behave nicely. They either ignore current directory (anyone can use absolutely any directory to start any application; it's also called "start directory"), or input/output file locations would totally depend on this directory (approach typical for console-only applications), but it all cases it would nicely inform you on what it expects. But stupid people often write application which don't behave nicely. But why using them?

Anyway, I fully answered your question; please try it out.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900