Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

c# process command line arguments with multiple arguments and whitespaces

$
0
0

I've got the following code which starts a python script:

string firstPath = "C:/User/first folder/filestring secondPath = "C:/User/second folder/filestring args = string.Format("pythonScript.py {0} {1}", firstPath, secondPath);    Process.StartInfo.Arguments = args;

This works fine, if firstPath and secondPath doesn't have whitespaces. But if I've got whitespaces in those paths, it doesn't work anymore. I've already tried

string args = string.Format("\"pythonScript.py {0} {1}\"", firstPath, secondPath);

But it doesn't work.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>