[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

CF 3.5 System.Diagnostics.ProcessStartInfo - File Not Found

Posted on 2008-10-15
4
Medium Priority
?
1,307 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 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

656 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