?
Solved

wordpad bug relating to blank space in file name of document

Posted on 2009-05-08
1
Medium Priority
?
298 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
1 Comment
 
LVL 1

Accepted Solution

by:
Abbotshea earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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 …

839 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