473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

ProcessStartInfo.Arguments don't undersrand SPACE?

3
I'm writting a method which will start a new specified program and specified file e.g start testdoc.doc with WINWORD.exe as below:

private void Start_Process()
{
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = "WINWORD.exe";
startInfo.Arguments = @"c:\testfolder\testdoc.doc";
Process.Start(startInfo);
}

Problem is: when the Arguments is simple as @"c:\testfolder\testdoc.doc" the program start out ok. But if I use address with space such as @"C:\Documents and Settings\My Test Folder\TestDoc.doc" WINWORD cannot start the TestDoc.doc as it cannot understand the space in the file path.

Is there any way to fix this or I have to use difference methods?
Aug 8 '08 #1
4 20048
Curtis Rutland
3,256 Expert 2GB
just a guess off the top of my head, but try adding escaped quotes around the path:
"\"path with space\""
and see if that helps.
Aug 8 '08 #2
melisa
3
Adding escape quote did help much though.
Anyway I found a way throught: adding quote (not quote escape) and everything goes well. Like this @"""C:\Documents and Settings\My Test Folder\TestDoc.doc"""
There are 3 quote each start and end of string.
Aug 8 '08 #3
Plater
7,872 Expert 4TB
haha yes, when using the @ before a string, escape sequences are ignored, so escape-quotes would not work if you used the @ sign

Another way around it for example:
Expand|Select|Wrap|Line Numbers
  1. string n=@"C:\Documents and Settings\My Test Folder\TestDoc.doc";
  2. string nn="\""+n+"\"";
  3.  
Aug 8 '08 #4
melisa
3
I did try and it did work 8)
Thanks you guys.
Aug 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Matt | last post by:
I am running a exe from command line in my application and when I use ProcessStartInfo it seems to duplicate all the commands within the function. for instance I write a file. Without my...
1
by: nospam | last post by:
Hi, Can you let me know why this won't display the standard output on console? Thanks Process myProcess = new Process();
0
by: Leo Heska | last post by:
Hi I haven't seen the following problem mentioned anywhere We have an application written in VB.NET which executes a batch file (named startJob.cmd). We have discovered that if that batch file...
2
by: Eranga | last post by:
I have a windows application in C# which has the following method public void InitiateSession(string server,string userName, string passWd ) { //To start the command...
1
by: spamproof2005 | last post by:
I have the following code: Dim BrowserLauncher As New ProcessStartInfo BrowserLauncher.FileName = URL BrowserLauncher.CreateNoWindow = False BrowserLauncher.UseShellExecute = True...
26
by: Martin Jørgensen | last post by:
Hi, I'm learning C-programming. I have a program which I would like to modify so it takes arguments from the commandline. Let call the program: program.exe. Could somebody shortly explain how...
2
by: Alexander van Doormalen | last post by:
I am trying to run an external process (command tool) within a Windows Service with the specified account. When the application launches I get a error dialog with the following message: ...
1
by: Vinny Vinn | last post by:
I am using the following C# code to print a PDF to a network printer. The document prints in portrait mode, I would like the document to print in Landscape mode. Is there/What is the argument that...
2
by: =?Utf-8?B?TWljaGVsbGUgTWFiZWxsZQ==?= | last post by:
I have the code below. It will open and print the pdf file (test.pdf) to the printer. ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.UseShellExecute = true; startInfo.Verb =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.