Solved

wordpad bug relating to blank space in file name of document

Posted on 2009-05-08
1
276 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 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
Viewers will learn the different options available in the Backstage view in Excel 2013.

762 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

18 Experts available now in Live!

Get 1:1 Help Now