troubleshooting Question

How to format Process.StartInfo.Arguments with spaces in the arguments?

Avatar of ipjyo
ipjyoFlag for United States of America asked on
.NET ProgrammingC#File Sharing Software
17 Comments6 Solutions2485 ViewsLast Modified:

I am trying to invoke an ftp command from my C# application using a Process.
I have the below code in my program.
I have spaces in the first argument of the Process and it is acting weird and not formatting properly.

scriptfile = "C:\Program files\PR Ent\AddIns\PR Bridge\Upload\UploadScript.txt";
s.Filename = "File1";

Process P = new Process();
                    P.EnableRaisingEvents = true;
                    P.Exited += P_Exited;
                    P.StartInfo.FileName = filename;
                    P.StartInfo.Arguments = scriptfile + s.Filename;

Could anybody please help me how to format properly when having spaces?

Thank you.
Sr. System Analyst

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 6 Answers and 17 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 6 Answers and 17 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros