Solved

CF 3.5 System.Diagnostics.ProcessStartInfo - File Not Found

Posted on 2008-10-15
4
1,266 Views
Last Modified: 2013-11-17
Hi..
I'm using the compact framework and trying to lauch a program with the following code.
But I get file not found. The file is int he Program FIles folder
what am I doing wrong ? thanks

     System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                Info.FileName = TEST.EXE;
                Info.UseShellExecute = false;
                Info.Arguments = null;
                Info.WorkingDirectory = "\program files\myCrap\:
                System.Diagnostics.Process.Start(Info);
0
Comment
Question by:JElster
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:jfmador
ID: 22723482
Use double \ for your path, because "\" will look for a special character like \n for new line \t for a tab space, etc.  You can also use @ before your string to prevent the compiler to translate the \ as a special charater

this :
Info.WorkingDirectory = "\\program files\\myCrap\\":
or
Info.WorkingDirectory = @"\program files\myCrap\":

instead of this
Info.WorkingDirectory = "\program files\myCrap\:
0
 
LVL 1

Author Comment

by:JElster
ID: 22723983
Hi..
I tried those.. same issue
????
0
 
LVL 5

Accepted Solution

by:
jfmador earned 100 total points
ID: 22724054
try using full path in filename instead of workingdirectory
Also add a System.IO.FileExists Condition and show the full path if file not found, be sure you didn't mistyped the file name

     System.Diagnostics.ProcessStartInfo Info = new System.Diagnostics.ProcessStartInfo();
                Info.FileName = @"\program files\mycrap\TEST.EXE";
                Info.UseShellExecute = false;
                Info.Arguments = null;

    if (System.IO.File.Exists(info.FileName))
          System.Diagnostics.Process.Start(Info);
    else
         MessageBox.Show("Unable to find : " + info.FileName);
0
 
LVL 1

Author Comment

by:JElster
ID: 22724730
If I set the filename with the path it works
If I set the working directory with just the path it does not.

???
thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now