file batch - command line to redirect to a file.txt

Viewed 43

If I write:

ipconfig /all >> c: \ list.txt

will be addressed the output to the C: \ List.txt file

If instead I write:

ECHO OFF
cls
Set /p rule_name = what name to the new rule?:
cls
Set /p ip_block = which ip you want to block "%rule_name%"?

Netsh Advfirewall Firewall Add rule Name = "%rule_name%" dir = in action = block remoteip = "%ip_block%"

This last line is first compiled by variables and then executed.

Therefore if in the variable rule_name I insert AAA

And in the IP_Block variable I insert 14.15.15.13

will become

Netsh Advfirewall Firewall Add rule name = AAA dir = in action = block remoteip = 14.15.15.13

And then it will be executed.

There is a way, to send the compiled row,

Netsh Advfirewall Firewall Add rule name = a dir = in action = block remoteip = 14.15.15.13

to a TXT file?

0 Answers
Related