'How to use string builder to make command for cmd to include value from variable?

I need to create a string command for cmd, it already uses ${serverip} so I cant use string interpolation. Any suggestions?

string command = "tftp ${serverip}:/nfs/{MY_VALUE}";

I cant use:

string command = $"...";

It will read ${serverip}.



Solution 1:[1]

We can try to use double curly-brackets {{ to escape from Interpolated Strings

string command = $"tftp ${{serverip}}:/nfs/{MY_VALUE}";

c# online

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 D-Shih