You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@tomasr78 what token(s) do you want the program to receive? What OS are you using?
If you want to send 2 tokens user= and this is the password, you should pass new[] { "user=", "\"this is the password\"" } to the command.
If you want to send just one token user=\"this is the password\", then you should pass just one token new[] { "user=\"this is the password\"" }.
A rare possibility is that you are dealing with a legacy program (likely written in a low-level language) that doesn't comply with the OS rules for how arguments should be escaped/tokenized. In this case, neither of the above will get you the desired behavior. To work around this, you can use a StartInfo initializer instead of passing explicit arguments:
Command.Run(
"some.exe",
Array.Empty<object>(),
options: o => o.StartInfo(si => si.Arguments = "whatever string I want")
);
While this last case is theoretically possible from what I've read, in practice I've yet to come across a case where this was required. It is risky because you are giving up built-in command line escaping.
Could you let me know how to pass such a parameter?
user="this is the password"
The MedallionShell adds additional quotes on top of the current parameter.
If I split one parameter to two like this
user=
this is the password
It adds space between parameters and it becomes
user= "this is the password"
and command line breaks.The text was updated successfully, but these errors were encountered: