"netsh" cmd Commands not being executed
Well, I am trying to set up some firewall-rules and such, the problem is non of the commands is being properly executed. I got to the conclusion while looking for why the server does not work. My approach was to try to delete the firewall rule after running the program, as of proof for that it existed in the first place, it turned out, it didn't, my code is:
5 Replies
Terminal output:
PortNum:25565
Local_IPAddress_Probe1: 192.168.178.36
Local_IPAddress_Probe2: 192.168.178.36
does running those commands directly in cmd work?
also, is your app running in the background? b/c Verb = RunAs will trigger UAC
Allright! I found a solution after ages, here is the working code now, tho if anyone knows how to make you only have to click the "ok" button once, I would love to hear that as it is really annoying to have to give the app a administrative-level multiple times over.
Working code:
tho if anyone knows how to make you only have to click the "ok" button onceyou would have to put all the command calls into one Process also, protip, use string interpolation instead of concat, eg in cmd you can run multiple commands by separating them with
&&
something like that
raw interpolated string
the ^
tells cmd to ignore the newline, so you can split the command across multiple linesCool, Thaks a lot for the Tip, I'll try to remember!