将路径字符串作为Process参数传递的问题。 [英] Problem with passing path string as Process argument .
问题描述
proc.StartInfo.Arguments =D:\ Pre Requisite Utility;
通过路径字符串作为参数,但在其他应用程序中获取此D:\Pre。这是一条完整的路径,但空格使它成为3个参数,D:\ Pre,必需,实用程序。我想发送完整的路径作为一个。我怎么能这样做。
提前感谢您的帮助。
Arguments属性是一个参数列表,用空格分隔。
如果你想传递一个包含空格的参数(或多个),你必须用双引号括起来。
proc.StartInfo.Arguments =D:\ Pre Requisite Utility;
必须更改为
proc.StartInfo.Arguments =\D:\\Pre Requisite Utility \;
当你有多个参数时,你有一个接一个地围绕它们,例如:
proc.StartInfo.Arguments =\第一个参数\\第二个argument \\第三个参数\;
请注意,这与旧DOS的行为相同。 />
问候,
Daniele。
< blockquote>现在正在将空格转换为%,
.Replace('''',''%'')
但还有另一种更好的方法吗?
嗨亲爱的
请使用此。
proc.StartInfo.Arguments =(@D:\\ \\ Pre Requisite Utility)。替换('''''''%'');
谢谢
proc.StartInfo.Arguments = "D:\Pre Requisite Utility";
Am passing path string as argument, but am getting this "D:\Pre" in other application. this is whole one path but spaces are making it as 3 arguments, "D:\Pre" ,"Requisite","Utility". i want to send complete path as one. how can i do this.
Thanks in advance for help.
Arguments property is a list of arguments, separated by space.
If you want to pass an argument (or more than one) containing spaces, you have to surround them with double quotation marks.
proc.StartInfo.Arguments = "D:\Pre Requisite Utility";
have to be changed to
proc.StartInfo.Arguments = "\"D:\\Pre Requisite Utility\"";
When you have multiple arguments, you have to surround them one by one, like:
proc.StartInfo.Arguments = "\"First argument\" \"Second argument\" \"Third argument\"";
Note that this is the same behavior from old DOS.
Regards,
Daniele.
right now am converting spaces into %,.Replace('' '',''%'')but is there another better way to do this?
hi dear
pls use this.
proc.StartInfo.Arguments = (@"D:\Pre Requisite Utility").Replace('' '',''%'');
thanks
这篇关于将路径字符串作为Process参数传递的问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!