See example in C# here:
how to Block and Allow any specific port using c#[
^]
Note that in the example the string format is not correctly ended with a ):
String.Format("advfirewall firewall add rule name=\"{0}\" dir=in action=block protocol={1} localport={2} profile={3}",
"My rule name",
"TCP",
4567,
"Private")