Solved

wordpad bug relating to blank space in file name of document

Posted on 2009-05-08
1
286 Views
Last Modified: 2013-11-27
I am usinf vs2008 c# to open a file with wordpad.      I am using the code
System.Diagnostics.Process.Start(startInfo) to start wordpad.     The file I am interested in can contain a space.    Wordpad works fine with a file containing no spaces in the filename.
I tried adding %1% at the end of the wordpad name, but that did not work.    My code is below.
Again, this works fine for a file such as  "C:\\data1b.dat";  

Thanks mnarcowich2007                    
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
            startInfo.FileName = "wordpad.exe";
            startInfo.Arguments = "C:\\Program Files\\GuiDM\\Examples\\data1b.dat";                        
            System.Diagnostics.Process.Start(startInfo);

Open in new window

0
Comment
Question by:mnarcowich2007
[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
1 Comment
 
LVL 1

Accepted Solution

by:
Abbotshea earned 500 total points
ID: 24342016

make sure that the full name of the file is surrounded by another set of quotes.  Try:

startInfo.Arguments = "\"C:\\Program Files\\GuiDM\\Examples\\data1b.dat\"";
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

734 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