Solved

CF 3.5 System.Diagnostics.ProcessStartInfo - File Not Found

Posted on 2008-10-15
4
1,288 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

705 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